Commit Graph

1171 Commits

Author SHA1 Message Date
Sergey Nikishin
a3ced63792 Fix going into infinite loop in read_header_loose()
read_header_loose causes infinite loop on this file:
$ cat ../libcppgit/bin/sample-repo/test_mailbox/.git/objects/8f/e274605cbc740a2a957f44b2722a8a73915a09 | base64
eAErKUpNVTAzYzA0MDAzMVHISUxKzSlmWLgkuyN5+rxr6juMPR2EmN8s7Vl9D6oiN7UkkcHJdLbl
7Z3N/oxfE0W8wrSbuFRkAwDFfBn1
2011-04-22 17:41:36 +04:00
Vicent Martí
6b290755ea Merged pull request #138 from trentm/development.
fix solaris build
---
Before this patch the build failure looked like:

...
../../deps/zlib/inffast.c: In function `inflate_fast':
../../deps/zlib/inffast.c:324: warning: visibility attribute not supported in this configuration; ignored
[34/38] c: src/revwalk.c -> build/shared/src/revwalk.c.0.o
../../deps/zlib/inftrees.c: In function `inflate_table':
../../deps/zlib/inftrees.c:330: warning: visibility attribute not supported in this configuration; ignored
[35/38] c: deps/zlib/zutil.c -> build/shared/deps/zlib/zutil.c.0.o
[36/38] c: deps/zlib/trees.c -> build/shared/deps/zlib/trees.c.0.o
../../deps/zlib/zutil.c: In function `zcalloc':
../../deps/zlib/zutil.c:308: warning: visibility attribute not supported in this configuration; ignored
../../deps/zlib/zutil.c: In function `zcfree':
../../deps/zlib/zutil.c:316: warning: visibility attribute not supported in this configuration; ignored
../../deps/zlib/trees.c:1244: warning: visibility attribute not supported in this configuration; ignored
../../deps/zlib/trees.c:1244: warning: visibility attribute not supported in this configuration; ignored
../../deps/zlib/trees.c: In function `_tr_init':
../../deps/zlib/trees.c:410: warning: visibility attribute not supported in this configuration; ignored
../../deps/zlib/trees.c: In function `_tr_align':
../../deps/zlib/trees.c:919: warning: visibility attribute not supported in this configuration; ignored
../../deps/zlib/trees.c: In function `_tr_stored_block':
../../deps/zlib/trees.c:883: warning: visibility attribute not supported in this configuration; ignored

../../deps/zlib/trees.c: In function `_tr_flush_block':
../../deps/zlib/trees.c:1020: warning: visibility attribute not supported in this configuration; ignored
../../deps/zlib/trees.c: In function `_tr_tally':
../../deps/zlib/trees.c:1071: warning: visibility attribute not supported in this configuration; ignored
[37/38] cshlib: build/shared/src/blob.c.0.o build/shared/src/cache.c.0.o build/shared/src/commit.c.0.o build/shared/src/delta-apply.c.0.o build/shared/src/errors.c.0.o build/shared/src/filebuf.c.0.o build/shared/src/fileops.c.0.o build/shared/src/hash.c.0.o build/shared/src/hashtable.c.0.o build/shared/src/index.c.0.o build/shared/src/object.c.0.o build/shared/src/odb.c.0.o build/shared/src/odb_loose.c.0.o build/shared/src/odb_pack.c.0.o build/shared/src/oid.c.0.o build/shared/src/pqueue.c.0.o build/shared/src/refs.c.0.o build/shared/src/repository.c.0.o build/shared/src/revwalk.c.0.o build/shared/src/signature.c.0.o build/shared/src/tag.c.0.o build/shared/src/thread-utils.c.0.o build/shared/src/tree.c.0.o build/shared/src/util.c.0.o build/shared/src/vector.c.0.o build/shared/src/unix/map.c.0.o build/shared/src/backends/hiredis.c.0.o build/shared/src/backends/sqlite.c.0.o build/shared/deps/zlib/adler32.c.0.o build/shared/deps/zlib/deflate.c.0.o build/shared/deps/zlib/inffast.c.0.o build/shared/deps/zlib/inflate.c.0.o build/shared/deps/zlib/inftrees.c.0.o build/shared/deps/zlib/trees.c.0.o build/shared/deps/zlib/zutil.c.0.o build/shared/src/block-sha1/sha1.c.0.o -> build/shared/libgit2.so
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol zcfree: a GOT relative relocation must reference a local symbol
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol zcalloc: a GOT relative relocation must reference a local symbol
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol _length_code: a GOT relative relocation must reference a local symbol
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol _dist_code: a GOT relative relocation must reference a local symbol
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol _length_code: a GOT relative relocation must reference a local symbol
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol _dist_code: a GOT relative relocation must reference a local symbol
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol _dist_code: a GOT relative relocation must reference a local symbol
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol _length_code: a GOT relative relocation must reference a local symbol
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol _dist_code: a GOT relative relocation must reference a local symbol
ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol _dist_code: a GOT relative relocation must reference a local symbol
collect2: ld returned 1 exit status
Waf: Leaving directory `/home/node/src/libgit2/build/shared'
Build failed
 -> task failed (exit status 1): 
        {task 138650764: cshlib blob.c.0.o,cache.c.0.o,commit.c.0.o,delta-apply.c.0.o,errors.c.0.o,filebuf.c.0.o,fileops.c.0.o,hash.c.0.o,hashtable.c.0.o,index.c.0.o,object.c.0.o,odb.c.0.o,odb_loose.c.0.o,odb_pack.c.0.o,oid.c.0.o,pqueue.c.0.o,refs.c.0.o,repository.c.0.o,revwalk.c.0.o,signature.c.0.o,tag.c.0.o,thread-utils.c.0.o,tree.c.0.o,util.c.0.o,vector.c.0.o,map.c.0.o,hiredis.c.0.o,sqlite.c.0.o,adler32.c.0.o,deflate.c.0.o,inffast.c.0.o,inflate.c.0.o,inftrees.c.0.o,trees.c.0.o,zutil.c.0.o,sha1.c.0.o -> libgit2.so}
['/home/node/local/bin/gcc', '', 'src/blob.c.0.o', 'src/cache.c.0.o', 'src/commit.c.0.o', 'src/delta-apply.c.0.o', 'src/errors.c.0.o', 'src/filebuf.c.0.o', 'src/fileops.c.0.o', 'src/hash.c.0.o', 'src/hashtable.c.0.o', 'src/index.c.0.o', 'src/object.c.0.o', 'src/odb.c.0.o', 'src/odb_loose.c.0.o', 'src/odb_pack.c.0.o', 'src/oid.c.0.o', 'src/pqueue.c.0.o', 'src/refs.c.0.o', 'src/repository.c.0.o', 'src/revwalk.c.0.o', 'src/signature.c.0.o', 'src/tag.c.0.o', 'src/thread-utils.c.0.o', 'src/tree.c.0.o', 'src/util.c.0.o', 'src/vector.c.0.o', 'src/unix/map.c.0.o', 'src/backends/hiredis.c.0.o', 'src/backends/sqlite.c.0.o', 'deps/zlib/adler32.c.0.o', 'deps/zlib/deflate.c.0.o', 'deps/zlib/inffast.c.0.o', 'deps/zlib/inflate.c.0.o', 'deps/zlib/inftrees.c.0.o', 'deps/zlib/trees.c.0.o', 'deps/zlib/zutil.c.0.o', 'src/block-sha1/sha1.c.0.o', '-o', '', '/home/node/src/libgit2/build/shared/libgit2.so', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-shared', '-Wl,-h,libgit2.so.0']
...


If helpful, here is the equivalent error with varnish: http://www.varnish-cache.org/trac/ticket/852
and the autoconf/configure handling for the equivalent in python: http://hg.python.org/cpython/file/96e0e79d33de/Modules/zlib/configure#l513

So a better fix would probably be to reproduce that configure logic (see similar in the Varnish patch) ... but I'm not sure if shelling out to the C compiler (however waf spells that) is wanted in wscript here.

It would be great to have a libgit2 release with the quicker fix for Solaris. My actual issue is with building node-gitteh.

Thanks,
Trent
2011-04-21 15:22:37 -07:00
Vicent Martí
027eab91b7 Merged pull request #142 from potyl/development.
LIBGIT2_VER_MINOR now matches LIBGIT2_VERSION (0.11.0)
---
LIBGIT2_VER_MINOR was left at 10 instead of 11.
2011-04-21 15:20:46 -07:00
Emmanuel Rodriguez
5adb48e4a8 LIBGIT2_VER_MINOR now matches LIBGIT2_VERSION (0.11.0)
LIBGIT2_VER_MINOR was left at 10 instead of 11.
2011-04-21 21:21:44 +02:00
Jakob Pfender
4c0b6a6dac index: Add API for unmerged entries
New external functions:
	- git_index_unmerged_entrycount: Counts the unmerged entries in
	  the index
	- git_index_get_unmerged: Gets an unmerged entry from the index
	  by name

New internal functions:
	- read_unmerged: Wrapper for read_unmerged_internal
	- read_unmerged_internal: Reads unmerged entries from the index
	  if the index has the INDEX_EXT_UNMERGED_SIG set
	- unmerged_srch: Search function for unmerged vector
	- unmerged_cmp: Compare function for unmerged vector

New data structures:
	- git_index now contains a git_vector unmerged that stores
	  unmerged entries
	- git_index_entry_unmerged: Representation of an unmerged file
	  entry. It represents all three versions of the file at the
	  same time, with one name, three modes and three OIDs
2011-04-21 10:54:54 +02:00
Jakob Pfender
729b6f4900 index: Allow user to toggle whether to replace an index entry
When in the middle of a merge, the index needs to contain several files
with the same name. git_index_insert() used to prevent this by not adding a new entry if an entry with the same name already existed.
2011-04-21 10:40:54 +02:00
Jakob Pfender
df30eac1eb refs: Allow MERGE_HEAD in normalize_name()
Do not return with EINVALIDREFNAME when trying to normalize MERGE_HEAD's
name.
2011-04-21 10:38:37 +02:00
Trent Mick
34a2992665 fix solaris build
Before this patch the build failure looked like:
    ...
    ../../deps/zlib/inftrees.c:330: warning: visibility attribute not supported in this configuration; ignored
    ...
    ld: fatal: relocation error: R_386_GOTOFF: file deps/zlib/deflate.c.0.o: symbol zcfree: a GOT relative relocation must reference a local symbol
    ...
2011-04-20 22:25:30 -07:00
Carlos Martín Nieto
a68cf94b37 Fix const char ** warning
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-19 16:40:52 +02:00
Carlos Martín Nieto
e69ac2439f config: export git_config_[sg]et_long
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-19 16:38:55 +02:00
Carlos Martín Nieto
a99264bff6 config: allow uppercase number suffixes
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-19 16:34:22 +02:00
Vicent Marti
fee4c42550 Force position independent code in Linux 2011-04-16 01:58:43 +03:00
Vicent Marti
2571cc3cff Close file descriptor when writing a blob 2011-04-15 20:32:31 +03:00
Vicent Marti
90d743cd5d Refresh the list of packfiles on each ODB query
Fixes the issue where object lookups were failing right after a pull on
an open repository.
2011-04-15 15:12:37 +03:00
Carlos Martín Nieto
1bfa053e8c Close an object in packed_find_peel
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-13 21:57:35 +02:00
Carlos Martín Nieto
7c1c15a7fb tests: free the test suite name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-13 21:55:43 +02:00
Carlos Martín Nieto
2fe3692c23 tests: don't leak objects
If we don't create any leaks in the tests, we can use them to search
for leaks in the implementation.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-13 21:50:11 +02:00
Vicent Marti
def3fef197 Add git_tag_list
Lists all the tag references in a repository using a custom callback.
Includes unit tests courtesy of Emeric Fermas <3
2011-04-12 15:55:51 -07:00
Carlos Martín Nieto
53345e1f1f config: add tests for number suffix
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-11 18:01:01 +02:00
Carlos Martín Nieto
52ca4f8a39 Use internal strtol
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-11 17:51:05 +02:00
Carlos Martín Nieto
631752aaf6 Fix number suffix detection
Allow a number not to have a suffix. This broke when adding the
suffixes.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-11 17:50:22 +02:00
Carlos Martín Nieto
55c197cdd3 Merge upstream/development 2011-04-11 17:43:56 +02:00
Jakob Pfender
1eb0f68ec7 merge branch development 2011-04-11 12:38:50 +02:00
Vicent Marti
fdd0cc9e89 Fix path normalization tests
They were backtracking too deep into the filesystem on Linux, where the
tests were running directly on `tmp/`.
2011-04-10 15:25:41 -07:00
Vicent Marti
a6359408a5 Use Z_BEST_SPEED for filebuf deflating
This is what Git uses by default for all deflating.
2011-04-10 12:23:55 -07:00
Vicent Marti
fff036ec15 Import 'with' from __future__ in the build script 2011-04-09 17:45:38 -07:00
Vicent Marti
53b7560ba5 Fix time_t conversion on Win32 2011-04-09 16:16:09 -07:00
Vicent Marti
14eb94eefa Fix gmtime issues in Win32 2011-04-09 16:06:17 -07:00
Vicent Marti
8416c9adcc Rename git_signature_new_now
The new name is more cool.
2011-04-09 15:31:12 -07:00
Carlos Martín Nieto
9e9e6ae177 Add API git_signature_new_now
Most tags will have a timestamp of whenever the code is running and
dealing with time and timezones is error-prone. Optimize for this case
by adding a function which causes the signature to be created with a
current timestamp.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-09 15:29:48 -07:00
Carlos Martín Nieto
b5c00c6d41 Fix the signature documentation
The parameters are given by '@param name' and not '@name'.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-09 15:29:28 -07:00
Carlos Martín Nieto
076141a137 Add a few malloc checks
Add checks to see if malloc failed when allocating the tag members and
signature members.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-09 15:27:16 -07:00
nulltoken
4a34b3a9ff Add two new accessors to the repository
git_repository_path() and git_repository_workdir() respectively return the path to the git repository and the working directory. Those paths are absolute and normalized.
2011-04-09 15:25:24 -07:00
Vicent Marti
c6e65acae6 Properly check strtol for errors
We are now using a custom `strtol` implementation to make sure we're not
missing any overflow errors.
2011-04-09 15:22:11 -07:00
Vicent Marti
b918ae40d1 Do not declare variables in the middle of a func 2011-04-08 15:35:25 -07:00
Vicent Marti
41233c40c0 Add new method git_repository_is_empty 2011-04-08 12:42:18 -07:00
Vicent Marti
cef75d7430 Remove unused variables from test files 2011-04-08 12:41:17 -07:00
Vicent Marti
d79f1da65a refs: Fix issue when packing weak tags
Weak tags (e.g. tags that point directly to a normal object instead of a
tag object) were failing to be packed.
2011-04-08 12:14:33 -07:00
Carlos Martín Nieto
6ac247b381 tag: don't check twice if an object exists
Remove the check in git_tag_create_frombuffer as it's done by
tag_create already.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-08 03:36:53 +03:00
Carlos Martín Nieto
7bc66a79fa tag: don't allow tags to non-existent objects
These indicate an inconsistency in the repository which we've created,
so don't allow them.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-08 03:36:53 +03:00
Carlos Martín Nieto
81234673a1 tag: discover the target type if needed
Don't blindly pass the target type to git_tag_type2string as it will
give an empty string on GIT_OBJ_ANY which would cause us to create an
invalid tag object.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-08 03:36:53 +03:00
Jakob Pfender
26f2c897b8 index.h: Add IDXENTRY flags needed for index operations
Add several IDXENTRY flags that need to be checked in
order to properly implement update-index --refresh.
2011-04-08 03:33:50 +03:00
Sam
5924b2822c Added git_commit_tree_oid and git_commit_parent_oid. 2011-04-08 03:33:46 +03:00
Shuhei Tanuma
98ac678085 fix git_treebuilder_insert probrem.
couldn't add new entry when inserting new one with `git_treebuilder_insert`.
2011-04-08 03:30:47 +03:00
Vicent Marti
5868cd02b7 Do not assert error codes on Hiredis backend
We cannot assume that Redis is never going to return an error code; when
Reddit fails, we cannot crash our library, we need to handle the crash
gracefully.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-04-08 03:28:38 +03:00
Dmitry Kovega
8a64bc292c redis backend 2011-04-08 03:27:01 +03:00
Carlos Martín Nieto
b075b9910c Add getting and setting of long int variables
long int is a safer type than int unless the user knows that the
variable is going to be quite small.

The code has been reworked to use strtol instead of the more
complicated sscanf.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-07 17:17:18 +02:00
Carlos Martín Nieto
7a4dfd6028 Simplify error path in config_set
Many error paths freed their local data althought it is freed later on
when the end of the function notices that there was an error. This can
cause double frees and invalid memory access.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-07 17:15:38 +02:00
Carlos Martín Nieto
493384e39c config: make cvar_free behave more like other free functions
Make cvar_free return void instad of the next element, as it was
mostly a hack to make cvar_list_free shorter but it's now using the
list macros.

Also check if the input is NULL and return immediately in that case.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-07 17:15:38 +02:00
Carlos Martín Nieto
6b45cb8a89 config: use and implement list macros
Use list macros instead of manually changing the head and/or tail of
the variable list.
2011-04-07 17:15:30 +02:00