|
f673e232
|
2018-12-27T13:47:34
|
|
git_error: use new names in internal APIs and usage
Move to the `git_error` name in the internal API for error-related
functions.
|
|
0c7f49dd
|
2017-06-30T13:39:01
|
|
Make sure to always include "common.h" first
Next to including several files, our "common.h" header also declares
various macros which are then used throughout the project. As such, we
have to make sure to always include this file first in all
implementation files. Otherwise, we might encounter problems or even
silent behavioural differences due to macros or defines not being
defined as they should be. So in fact, our header and implementation
files should make sure to always include "common.h" first.
This commit does so by establishing a common include pattern. Header
files inside of "src" will now always include "common.h" as its first
other file, separated by a newline from all the other includes to make
it stand out as special. There are two cases for the implementation
files. If they do have a matching header file, they will always include
this one first, leading to "common.h" being transitively included as
first file. If they do not have a matching header file, they instead
include "common.h" as first file themselves.
This fixes the outlined problems and will become our standard practice
for header and source files inside of the "src/" from now on.
|
|
909d5494
|
2016-12-29T12:25:15
|
|
giterr_set: consistent error messages
Error messages should be sentence fragments, and therefore:
1. Should not begin with a capital letter,
2. Should not conclude with punctuation, and
3. Should not end a sentence and begin a new one
|
|
3603cb09
|
2015-02-10T23:13:49
|
|
git__*allocarray: safer realloc and malloc
Introduce git__reallocarray that checks the product of the number
of elements and element size for overflow before allocation. Also
introduce git__mallocarray that behaves like calloc, but without the
`c`. (It does not zero memory, for those truly worried about every
cycle.)
|
|
392702ee
|
2015-02-09T23:41:13
|
|
allocations: test for overflow of requested size
Introduce some helper macros to test integer overflow from arithmetic
and set error message appropriately.
|
|
ea66215d
|
2014-10-26T10:29:19
|
|
Removed some useless variable assignments
|
|
4ca0b566
|
2014-08-18T12:41:06
|
|
oid: Export `git_oid_tostr_s` instead of `_allocfmt`
The old `allocfmt` is of no use to callers, as they are not able to free
the returned buffer. Export a new API that returns a static string that
doesn't need to be freed.
|
|
00258cc0
|
2014-03-06T22:10:17
|
|
git_oid_fromstrn: Simplify the implementation and fix memory access issues
|
|
978a4ed5
|
2014-02-20T11:00:31
|
|
Make git_oid_equal a non-inline API
|
|
32b7e84e
|
2014-01-12T23:31:35
|
|
oid: handle NULL pointers passed to git_oid_shorten_free()
Signed-off-by: Brodie Rao <brodie@sf.io>
|
|
66566516
|
2013-09-08T17:15:42
|
|
Fix warning
|
|
d45e9480
|
2013-08-31T18:22:50
|
|
oid: git_oid_shorten_add() sets GITERR_INVALID when OID set is full
|
|
30caf0cf
|
2013-05-24T01:13:48
|
|
Merge pull request #1595 from arrbee/even-more-rename-fixes
Even more rename detection fixes
|
|
52f537e9
|
2013-05-22T02:04:12
|
|
Bugfix: Return NULL in push_leaf, when trie is full
os->full was set 1, but the overflowed idx_leaf was still used to index
into os->nodes a little later. Returning NULL fixes that.
|
|
660d59ca
|
2013-05-17T16:40:00
|
|
Add git_oid_nfmt - a flexible OID formatter
I frequently want to the the first N digits of an OID formatted
as a string and I'd like it to be efficient. This function makes
that easy and I could rewrite the OID formatters in terms of it.
|
|
b7f167da
|
2013-04-29T13:52:12
|
|
Make git_oid_cmp public and add git_oid__cmp
|
|
aa8f0101
|
2013-04-29T08:59:46
|
|
Add git_oid_strcmp and use it for git_oid_streq
Add a new git_oid_strcmp that compares a string OID with a hex
oid for sort order, and then reimplement git_oid_streq using it.
This actually should speed up git_oid_streq because it only reads
as far into the string as it needs to, whereas previously it would
convert the whole string into an OID and then use git_oid_cmp.
|
|
8564a022
|
2013-04-29T08:51:24
|
|
Fix fragile git_oid_ncmp
git_oid_ncmp was making some assumptions about the length of
the data - this shifts the check to the top of the loop so it
will work more robustly, limits the max, and adds some tests
to verify the functionality.
|
|
0c72248b
|
2013-04-29T07:34:13
|
|
Introduce git_oid_compare, an exported oid cmp
|
|
13640d1b
|
2013-03-25T21:39:11
|
|
oid: Do not parse OIDs longer than 40
|
|
1e7b7523
|
2013-03-21T12:30:08
|
|
git_oid_fromstrn already sets a maximum on the length of the string
|
|
0c8efb38
|
2013-03-21T11:59:01
|
|
Added an oid function that accepts nul-terminated strings
|
|
359fc2d2
|
2013-01-08T17:07:25
|
|
update copyrights
|
|
1b88faf7
|
2013-01-03T14:21:25
|
|
Fix oid tostr issue with NULL oid
I made a small change to the behavior of this code and apparently
got it wrong. Sigh.
|
|
8fe713cc
|
2012-12-19T15:06:14
|
|
Make git_oid_tostr use out buffer for NULL oid
Previously a NULL oid was handled like an empty buffer and
returned a status empty string. This makes git_oid_tostr()
set the output buffer to the empty string instead.
|
|
826bc4a8
|
2012-11-23T13:31:22
|
|
Remove use of English expletives
Remove words such as fuck, crap, shit etc.
Remove other potentially offensive words from comments.
Tidy up other geopolicital terms in comments.
|
|
c9de8611
|
2012-08-23T12:29:09
|
|
Revparse: GIT_EAMBIGUOUS
Revparse now returns EAMBIGUOUS if the the spec
doesn't match any refs/tags, and is <4 characters.
|
|
e25dda51
|
2012-08-02T01:38:30
|
|
Merge remote-tracking branch 'nulltoken/topic/amd64-compat' into development
Conflicts:
src/netops.c
src/netops.h
src/oid.c
|
|
f6b26e77
|
2012-07-27T10:53:09
|
|
git_oid_cmp: inline memcmp by hand to optimize
git.git uses an inlined hashcmp function instead of memcmp, since it
performes much better when comparing hashes (most hashes compared
diverge within the first byte).
Measurements and rationale for the curious reader:
http://thread.gmane.org/gmane.comp.version-control.git/172286
|
|
b8457baa
|
2012-07-24T07:57:58
|
|
portability: Improve x86/amd64 compatibility
|
|
40879fac
|
2012-05-02T15:59:02
|
|
Merge branch 'new-error-handling' into development
Conflicts:
.travis.yml
include/git2/diff.h
src/config_file.c
src/diff.c
src/diff_output.c
src/mwindow.c
src/path.c
tests-clar/clar_helpers.c
tests-clar/object/tree/frompath.c
tests/t00-core.c
tests/t03-objwrite.c
tests/t08-tag.c
tests/t10-refs.c
tests/t12-repo.c
tests/t18-status.c
tests/test_helpers.c
tests/test_main.c
|
|
44ef8b1b
|
2012-04-13T13:00:10
|
|
Fix warnings on 64-bit windows builds
This fixes all the warnings on win64 except those in deps, which
come from the regex code.
|
|
73fe6a8e
|
2012-03-28T18:59:12
|
|
error-handling: Commit (WIP)
|
|
7c7ff7d1
|
2012-03-19T16:10:11
|
|
Migrate index, oid, and utils to new errors
This includes a few cleanups that came up while converting
these files.
This commit introduces a could new git error classes, including
the catchall class: GITERR_INVALID which I'm using as the class
for invalid and out of range values which are detected at too low
a level of library to use a higher level classification. For
example, an overflow error in parsing an integer or a bad letter
in parsing an OID string would generate an error in this class.
|
|
5621d809
|
2012-03-06T17:51:04
|
|
Rename git_oid_to_string to git_oid_tostr
To conform the naming scheme of git_oid_fromstr we should change the
name of git_oid_to_string to git_oid_tostr.
|
|
74fa4bfa
|
2012-02-28T16:14:47
|
|
Update diff to use iterators
This is a major reorganization of the diff code. This changes
the diff functions to use the iterators for traversing the
content. This allowed a lot of code to be simplified. Also,
this moved the functions relating to outputting a diff into a
new file (diff_output.c).
This includes a number of other changes - adding utility
functions, extending iterators, etc. plus more tests for the
diff code. This also takes the example diff.c program much
further in terms of emulating git-diff command line options.
|
|
5e0de328
|
2012-02-13T17:10:24
|
|
Update Copyright header
Signed-off-by: schu <schu-github@schulog.org>
|
|
eb8de747
|
2011-12-28T20:24:58
|
|
util: add git__fromhex()
|
|
3286c408
|
2011-10-28T14:51:13
|
|
global: Properly use `git__` memory wrappers
Ensure that all memory related functions (malloc, calloc, strdup, free,
etc) are using their respective `git__` wrappers.
|
|
34aff010
|
2011-10-12T14:06:23
|
|
oid: Add git_oid_streq() which checks if an oid and an hex formatted string are equal
|
|
0e058e78
|
2011-10-02T21:40:57
|
|
oid: add missing check to git_oid_fromstrn
Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
|
|
b9caa185
|
2011-09-30T19:50:13
|
|
oid: now git_oid_fromstrn checks whether the given string is too short
Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
|
|
6d8d3f19
|
2011-09-30T19:41:29
|
|
oid: optimize git_oid_fromstrn by using memset
Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
|
|
e724b058
|
2011-09-30T19:08:48
|
|
oid: make git_oid_fromstrn support hex strings of odd length
This fixes issue #433.
Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
|
|
87d9869f
|
2011-09-19T03:34:49
|
|
Tabify everything
There were quite a few places were spaces were being used instead of
tabs. Try to catch them all. This should hopefully not break anything.
Except for `git blame`. Oh well.
|
|
bb742ede
|
2011-09-19T01:54:32
|
|
Cleanup legal data
1. The license header is technically not valid if it doesn't have a
copyright signature.
2. The COPYING file has been updated with the different licenses used in
the project.
3. The full GPLv2 header in each file annoys me.
|
|
afeecf4f
|
2011-07-09T02:10:46
|
|
odb: Direct writes are back
DIRECT WRITES ARE BACK AND FASTER THAN EVER. The streaming writer to the
ODB was an overkill for the smaller objects like Commit and Tags; most
of the streaming logic was taking too long.
This commit makes Commits, Tags and Trees to be built-up in memory, and
then written to disk in 2 pushes (header + data), instead of streaming
everything.
This is *always* faster, even for big files (since the git_filebuf class
still does streaming writes when the memory cache overflows). This is
also a gazillion lines of code smaller, because we don't have to
precompute the final size of the object before starting the stream (this
was kind of defeating the point of streaming, anyway).
Blobs are still written with full streaming instead of loading them in
memory, since this is still the fastest way.
A new `git_buf` class has been added. It's missing some features, but
it'll get there.
|
|
06c43821
|
2011-07-09T02:37:16
|
|
Remove unused methods
The direct-writes commit left some (slow) internals methods that
were no longer needed. These have been removed.
Also, the Reflog code was using the old `git_signature__write`, so
it has been rewritten to use a normal buffer and the new `writebuf`
signature writer. It's now slightly simpler and faster.
|
|
f0ab9fda
|
2011-07-08T18:22:44
|
|
index: Return `GIT_ENOTFOUND` when an entry cannot be opened
|
|
932d1baf
|
2011-06-30T19:52:34
|
|
cleanup: remove trailing spaces
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
|
|
d5afc039
|
2011-06-28T19:15:48
|
|
Remove redundant methods from the API
A bunch of redundant methods have been removed from the external API.
- All the reference/tag creation methods with `_f` are gone. The force
flag is now passed as an argument to the normal create methods.
- All the different commit creation methods are gone; commit creation
now always requires a `git_commit` pointer for parents and a `git_tree`
pointer for tree, to ensure that corrupted commits cannot be generated.
- All the different tag creation methods are gone; tag creation now
always requires a `git_object` pointer to ensure that tags are not
created to inexisting objects.
|
|
f1d01851
|
2011-06-16T02:48:48
|
|
oid: Uniformize ncmp methods
Drop redundant methods. The ncmp method is now public
|
|
fa48608e
|
2011-06-16T02:36:21
|
|
oid: Rename methods
Yeah. Finally. Fuck the old names, this ain't POSIX
and they don't make any sense at all.
|
|
737406b7
|
2011-06-14T09:31:19
|
|
fix gid_ misspelling
|
|
c09093cc
|
2011-06-06T10:55:36
|
|
Renamed git_oid_match to git_oid_ncmp.
As suggested by carlosmn, git_oid_ncmp would probably
be a better name than git_oid_match, for it does the same
as git_oid_cmp but only up to a certain amount of hex digits.
|
|
da03c9f3
|
2011-05-29T11:45:34
|
|
Changed return value of git_oid_match to be consistent with the other compare methods (0 means oids match). Added method to compare prefixes of hex formatted oids.
|
|
53c0bd81
|
2011-05-27T22:37:10
|
|
Added error for ambiguous oid prefixes. Added methods to compare the first nth hexadecimal characters (i.e. packets of 4 bits) of OIDs.
|
|
bea54842
|
2011-05-19T13:50:46
|
|
oid.c: Move to new error handling mechanism
|
|
720d5472
|
2011-04-02T12:42:04
|
|
Change `parse` methods to const buffer
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
72a3fe42
|
2011-03-18T19:38:49
|
|
I broke your bindings
Hey. Apologies in advance -- I broke your bindings.
This is a major commit that includes a long-overdue redesign of the
whole object-database structure. This is expected to be the last major
external API redesign of the library until the first non-alpha release.
Please get your bindings up to date with these changes. They will be
included in the next minor release. Sorry again!
Major features include:
- Real caching and refcounting on parsed objects
- Real caching and refcounting on objects read from the ODB
- Streaming writes & reads from the ODB
- Single-method writes for all object types
- The external API is now partially thread-safe
The speed increases are significant in all aspects, specially when
reading an object several times from the ODB (revwalking) and when
writing big objects to the ODB.
Here's a full changelog for the external API:
blob.h
------
- Remove `git_blob_new`
- Remove `git_blob_set_rawcontent`
- Remove `git_blob_set_rawcontent_fromfile`
- Rename `git_blob_writefile` -> `git_blob_create_fromfile`
- Change `git_blob_create_fromfile`:
The `path` argument is now relative to the repository's working dir
- Add `git_blob_create_frombuffer`
commit.h
--------
- Remove `git_commit_new`
- Remove `git_commit_add_parent`
- Remove `git_commit_set_message`
- Remove `git_commit_set_committer`
- Remove `git_commit_set_author`
- Remove `git_commit_set_tree`
- Add `git_commit_create`
- Add `git_commit_create_v`
- Add `git_commit_create_o`
- Add `git_commit_create_ov`
tag.h
-----
- Remove `git_tag_new`
- Remove `git_tag_set_target`
- Remove `git_tag_set_name`
- Remove `git_tag_set_tagger`
- Remove `git_tag_set_message`
- Add `git_tag_create`
- Add `git_tag_create_o`
tree.h
------
- Change `git_tree_entry_2object`:
New signature is `(git_object **object_out, git_repository *repo, git_tree_entry *entry)`
- Remove `git_tree_new`
- Remove `git_tree_add_entry`
- Remove `git_tree_remove_entry_byindex`
- Remove `git_tree_remove_entry_byname`
- Remove `git_tree_clearentries`
- Remove `git_tree_entry_set_id`
- Remove `git_tree_entry_set_name`
- Remove `git_tree_entry_set_attributes`
object.h
------------
- Remove `git_object_new
- Remove `git_object_write`
- Change `git_object_close`:
This method is now *mandatory*. Not closing an object causes a
memory leak.
odb.h
-----
- Remove type `git_rawobj`
- Remove `git_rawobj_close`
- Rename `git_rawobj_hash` -> `git_odb_hash`
- Change `git_odb_hash`:
New signature is `(git_oid *id, const void *data, size_t len, git_otype type)`
- Add type `git_odb_object`
- Add `git_odb_object_close`
- Change `git_odb_read`:
New signature is `(git_odb_object **out, git_odb *db, const git_oid *id)`
- Change `git_odb_read_header`:
New signature is `(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id)`
- Remove `git_odb_write`
- Add `git_odb_open_wstream`
- Add `git_odb_open_rstream`
odb_backend.h
-------------
- Change type `git_odb_backend`:
New internal signatures are as follows
int (* read)(void **, size_t *, git_otype *, struct git_odb_backend *, const git_oid *)
int (* read_header)(size_t *, git_otype *, struct git_odb_backend *, const git_oid *)
int (* writestream)(struct git_odb_stream **, struct git_odb_backend *, size_t, git_otype)
int (* readstream)( struct git_odb_stream **, struct git_odb_backend *, const git_oid *)
- Add type `git_odb_stream`
- Add enum `git_odb_streammode`
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
26022f07
|
2011-03-05T23:54:49
|
|
Add `git_oid_shorten` (unique OID minimzer)
Set of methods to find the minimal-length to uniquely identify every OID
in a list. Useful for GUI applications, commit logs and so on.
Includes stress test.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
86627121
|
2011-03-06T00:03:31
|
|
Fix type-conversion warning in MSVC
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
d6b5f5cc
|
2011-03-05T23:54:49
|
|
Add `git_oid_shorten`
Set of methods to find the minimal-length to uniquely identify every OID
in a list.
Includes stress test.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
44908fe7
|
2010-12-06T23:03:16
|
|
Change the library include file
Libgit2 is now officially include as
#include "<git2.h>"
or indidividual files may be included as
#include <git2/index.h>
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
d12299fe
|
2010-12-03T22:22:10
|
|
Change include structure for the project
The maze with include dependencies has been fixed.
There is now a global include:
#include <git.h>
The git_odb_backend API has been exposed.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
6f02c3ba
|
2010-12-05T20:18:56
|
|
Small source code readability improvements.
Replaced magic number "0" with GIT_SUCCESS constant wherever it made sense.
|
|
58519018
|
2010-10-28T02:07:18
|
|
Fix internal memory management on the library
String mememory is now managed in a much more sane manner.
Fixes include:
- git_person email and name is no longer limited to 64 characters
- git_tree_entry filename is no longer limited to 255 characters
- raw objects are properly opened & closed the minimum amount of
times required for parsing
- unit tests no longer leak
- removed 5 other misc memory leaks as reported by Valgrind
- tree writeback no longer segfaults on rare ocassions
The git_person struct is no longer public. It is now managed by the
library, and getter methods are in place to access its internal
attributes.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
552e23ba
|
2010-06-02T19:16:28
|
|
Fix a bug in the git_oid_to_string() function
When git_oid_to_string() was passed a buffer size larger than
GIT_OID_HEXSZ+1, the function placed the c-string NUL char at
the wrong position. Fix the code to place the NUL at the end
of the (possibly truncated) oid string.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
|
|
0ef9d2aa
|
2010-01-03T22:56:54
|
|
Fix some "signed v unsigned comparison" warnings with -Wextra
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
|
|
960ca1d7
|
2009-08-28T21:22:46
|
|
Add the git_oid_to_string() utility function
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
|
|
64a47c01
|
2008-12-30T23:21:36
|
|
Wrap malloc and friends and report out of memory as GIT_ENOMEM
We now forbid direct use of malloc, strdup or calloc within the
library and instead use wrapper functions git__malloc, etc. to
invoke the underlying library malloc and set git_errno to a no
memory error code if the allocation fails.
In the future once we have pack objects in memory we are likely
to enhance these routines with garbage collection logic to purge
cached pack data when allocations fail. Because the size of the
function will grow somewhat large, we don't want to mark them for
inline as gcc tends to aggressively inline, creating larger than
expected executables.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
213e720c
|
2008-12-20T20:47:41
|
|
Change usages of static inline to GIT_INLINE
Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
b3be0fc7
|
2008-12-03T23:54:47
|
|
Fix an "implicit function definition" warning on cygwin
In particular, the warning relates to malloc(), which is
declared in <stdlib.h>. This header is now included,
indirectly, via the "common.h" header.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
af795e49
|
2008-12-02T09:56:23
|
|
Add routines to convert git_oid to hex strings
[sp: Credit for some of this implementation goes to Pieter, I
started off a patch he proposed for libgit2 but reworked
enough of it that I don't want to blame him for any bugs.]
Suggested-by: Pieter de Bie <pdebie@ai.rug.nl>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
b7c891c6
|
2008-11-03T17:31:16
|
|
Add git_oid_cpy, git_oid_cmp as inline functions
These are easily built off the standard C library functions memcpy
and memcmp. By marking these inline we stand a good chance of
the C compiler replacing the entire thing with tight machine code,
because many compilers will actually inline a memcmp or memcpy when
the 3rd argument (the size) is a constant value.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
b3a2f90e
|
2008-11-03T18:00:49
|
|
Enable warnings by default and fix warning in oid.c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
50298f44
|
2008-11-01T15:55:01
|
|
Switch the license from BSD to GPL+libgcc exception
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
d1ea30c3
|
2008-11-01T15:42:23
|
|
Move include files to include/git/, drop git_ prefix from file names
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|