Commit Graph

1404 Commits

Author SHA1 Message Date
Vicent Martí
3737537b0c Merge pull request #338 from carlosmn/del-test-index-read
Remove extra git_index_read from the tests
2011-07-28 05:23:46 -07:00
Vicent Martí
2b7fffa892 Merge pull request #341 from carlosmn/development
Fixup network headers
2011-07-28 05:23:27 -07:00
Vicent Martí
0b762f892e Merge pull request #343 from mike-perdide/include_status
Including git2/status.h in the git2.h header.
2011-07-28 05:20:37 -07:00
Julien Miotte
b311e3132a Including git2/status.h in the git2.h header. 2011-07-27 18:33:20 +02:00
Carlos Martín Nieto
1e76676fb4 Fixup network headers
The network headers were still missing some formalities.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-07-27 01:22:50 +02:00
Vicent Martí
4930e72187 Merge pull request #340 from Jopie64/development
On some header files, GIT_END_DECL was absent while GIT_BEGIN_DECL wasn't
2011-07-26 15:25:46 -07:00
Johan 't Hart
136e7129d7 On some header files, GIT_END_DECL was absent while GIT_BEGIN_DECL wasn't. 2011-07-27 00:06:19 +02:00
Carlos Martín Nieto
20a7e8208e Remove extra git_index_read from the tests
When you open an index with git_index_open, the file is read before
the function returns. Thus, calling git_index_read after that is
useless.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-26 15:53:52 +02:00
Kirill A. Shutemov
05a62d1a82 filebuf: update git_filebuf.write signature to take non-const buffer
z_stream.next_in is non-const. Although currently Zlib doesn't modify
buffer content on deflate(), it might be change in the future. gzwrite()
already modify it.

To avoid this let's change signature of git_filebuf.write and rework
git_filebuf_write() accordingly.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:48 +02:00
Kirill A. Shutemov
76159921f4 index: rework index entry initialization routine
index_init_entry() renamed to index_entry_init(). Now it allocates entry
on its own.

git_index_add() and git_index_append() reworked accordingly.

This commit fixes warning:

/home/kas/git/public/libgit2/src/index.c: In function ‘index_init_entry’:
/home/kas/git/public/libgit2/src/index.c:452:14: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:47 +02:00
Kirill A. Shutemov
f939d39bec index: rework index_insert()
Now index_insert() takes copy of index entry, not coping it by itself.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:47 +02:00
Kirill A. Shutemov
b2dd681512 index: introduce index_entry_free()
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:47 +02:00
Kirill A. Shutemov
51917d9ca2 index: extract index_entry_dup() from index_insert()
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:47 +02:00
Kirill A. Shutemov
7d9cc9f81a index: fix cast warnings
/home/kas/git/public/libgit2/src/index.c: In function ‘git_index_clear’:
/home/kas/git/public/libgit2/src/index.c:228:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/index.c:235:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/index.c: In function ‘index_insert’:
/home/kas/git/public/libgit2/src/index.c:392:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/index.c:399:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/index.c: In function ‘read_unmerged’:
/home/kas/git/public/libgit2/src/index.c:681:35: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/index.c: In function ‘read_entry’:
/home/kas/git/public/libgit2/src/index.c:716:33: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:47 +02:00
Kirill A. Shutemov
84ef7f3636 tests: fix cast warnings
/home/kas/git/public/libgit2/tests/t00-core.c: In function ‘test_cmp’:
/home/kas/git/public/libgit2/tests/t00-core.c:78:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t00-core.c:78:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t07-hashtable.c: In function ‘hash_func’:
/home/kas/git/public/libgit2/tests/t07-hashtable.c:42:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t08-tag.c: In function ‘_gittest__write0’:
/home/kas/git/public/libgit2/tests/t08-tag.c:141:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t08-tag.c: In function ‘_gittest__write2’:
/home/kas/git/public/libgit2/tests/t08-tag.c:192:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t08-tag.c: In function ‘_gittest__write3’:
/home/kas/git/public/libgit2/tests/t08-tag.c:227:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t04-commit.c: In function ‘_gittest__write0’:
/home/kas/git/public/libgit2/tests/t04-commit.c:650:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t04-commit.c:651:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t04-commit.c: In function ‘_gittest__root0’:
/home/kas/git/public/libgit2/tests/t04-commit.c:723:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t04-commit.c:724:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t12-repo.c: In function ‘write_file’:
/home/kas/git/public/libgit2/tests/t12-repo.c:360:24: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:47 +02:00
Kirill A. Shutemov
b75bec94f8 refs: fix cast warning
/home/kas/git/public/libgit2/src/refs.c: In function ‘normalize_name’:
/home/kas/git/public/libgit2/src/refs.c:1681:12: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:47 +02:00
Kirill A. Shutemov
0cbbdc26a9 tree: fix cast warnings
/home/kas/git/public/libgit2/src/tree.c: In function ‘entry_search_cmp’:
/home/kas/git/public/libgit2/src/tree.c:47:36: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/tree.c: In function ‘git_treebuilder_remove’:
/home/kas/git/public/libgit2/src/tree.c:443:31: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:47 +02:00
Kirill A. Shutemov
2ba222c5c5 posix: declare 'buf' argument of p_write() as const
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:46 +02:00
Kirill A. Shutemov
03cdbab410 odb_pack: fix cast warnings
/home/kas/git/public/libgit2/src/odb_pack.c: In function ‘packfile_sort__cb’:
/home/kas/git/public/libgit2/src/odb_pack.c:702:24: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:703:24: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c: In function ‘nth_packed_object_offset’:
/home/kas/git/public/libgit2/src/odb_pack.c:944:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:944:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:944:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:948:9: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:948:9: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:948:9: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:952:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:952:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:952:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:953:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:953:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/odb_pack.c:953:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:46 +02:00
Kirill A. Shutemov
4414b355fc sha1: fix cast warnings
/home/kas/git/public/libgit2/src/sha1.c: In function ‘blk_SHA1_Block’:
/home/kas/git/public/libgit2/src/sha1.c:128:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:128:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:128:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:129:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:129:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:129:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:130:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:130:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:130:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:131:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:131:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:131:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:132:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:132:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:132:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:133:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:133:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:133:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:134:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:134:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:134:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:135:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:135:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:135:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:136:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:136:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:136:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:137:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:137:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:137:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:138:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:138:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:138:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:139:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:139:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:139:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:140:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:140:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:140:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:141:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:141:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:141:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:142:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:142:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:142:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:143:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:143:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/sha1.c:143:2: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:46 +02:00
Kirill A. Shutemov
803ca5cb92 revwalk: fix cast warning
/home/kas/git/public/libgit2/src/revwalk.c: In function ‘object_table_hash’:
/home/kas/git/public/libgit2/src/revwalk.c:120:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:46 +02:00
Kirill A. Shutemov
ba1de1af93 transport_local: fix cast warnings
home/kas/git/public/libgit2/src/transport_local.c: In function ‘cmp_refs’:
/home/kas/git/public/libgit2/src/transport_local.c:19:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/transport_local.c:20:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:46 +02:00
Kirill A. Shutemov
b42a7f01a5 reflog: fix cast warning
/home/kas/git/public/libgit2/src/reflog.c: In function ‘reflog_parse’:
/home/kas/git/public/libgit2/src/reflog.c:148:17: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:46 +02:00
Kirill A. Shutemov
14468c6be5 commit: fix cast warnings
/home/kas/git/public/libgit2/src/commit.c: In function ‘commit_parse_buffer’:
/home/kas/git/public/libgit2/src/commit.c:186:23: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/src/commit.c:187:27: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:46 +02:00
Vicent Martí
269beb4710 Merge pull request #336 from schu/cleanup
repository.c: remove obsolete TODO marker
2011-07-25 12:10:10 -07:00
Vicent Martí
738715eb4c Merge pull request #337 from belkiss/development
Modify struct definition to enable forward declare with C++ compiler, thus avoid including C library's header in C++ header.
2011-07-25 12:02:20 -07:00
Lambert CLARA
ac2351fdec Modify struct definition to enable forward declare with C++ compiler,
thus avoid including C library's header in C++ header.
2011-07-25 20:24:10 +02:00
schu
cf7dc39b82 repository.c: remove obsolete TODO marker
Signed-off-by: schu <schu-github@schulog.org>
2011-07-24 15:58:10 +02:00
Carlos Martín Nieto
7db40d450d index: use git_futils_readbuffer_updated
This helps readability a bit as well.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-23 14:30:40 +02:00
Carlos Martín Nieto
c498232812 refs: don't stat so much
In reference_read we stat a file and then call futils which stats it
again. Use git_futils_readbuffer_updated to avoid the extra stat
call. This introduces another parameter which is used to tell the
caller whether the file was read or not.

Modify the callers to take advantage of this new feature. This change
removes ~140 stat calls from the test suite.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-23 14:30:40 +02:00
Carlos Martín Nieto
c3da9f062d Add git_futils_readbuffer_updated
This extends the git_fuitls_readbuffer function to only read in if the
file's modification date is later than the given one. Some code paths
want to check a file's modification date in order to decide whether
they should read it or not. If they do want to read it, another stat
call is done by futils. This function combines these two operations so
we avoid one stat call each time we read a new or updated file.

The git_futils_readbuffer functions is now a wrapper around the new
function.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-23 14:30:40 +02:00
Vicent Marti
f630366f70 readme: Add hgit2 to the list of bindings 2011-07-22 04:27:21 +02:00
Vicent Martí
f08a084bb6 Merge pull request #334 from schu/typos
tag.c: fix tiny typo
2011-07-21 19:21:19 -07:00
Vicent Martí
1c8a4aafad Merge pull request #332 from kiryl/leaks
Fix two memory leaks pointed by valgrind
2011-07-21 19:20:52 -07:00
schu
46a78f79da tag.c: fix tiny typo
Signed-off-by: schu <schu-github@schulog.org>
2011-07-20 11:36:05 +02:00
Kirill A. Shutemov
26b1b15767 index: fix memory leak
We need really free vectors on index freeing, not only clear.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-19 16:09:20 +03:00
Kirill A. Shutemov
5c6ae00999 refs: fix memory leak on rename
Current implementation of git_reference_rename() removes 'ref' from
loose cache, but not frees it. In result 'ref' is not reachable any more
and we have got memory leak.

Let's re-add 'ref' with corrected name to loose cache instead of
'new_ref' and free 'new_ref' properly.

'rollback' path seems leak too. git_reference_rename() need to be rewritten
for proper resource management.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-19 16:09:09 +03:00
Vicent Martí
89fb9d0407 Merge pull request #327 from carlosmn/solaris
net: link necessary libraries in Solaris
2011-07-17 12:01:22 -07:00
Carlos Martín Nieto
e944cfa949 net: link necessary libraries in Solaris
Solaris needs programs to link to socket and nsl in order to use BSD
sockets. Tell CMake to do so, this time for real.

Thanks to boyski for bearing with me through the various iterations of
this patch.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-07-17 20:50:59 +02:00
Vicent Martí
33afca47cb Merge pull request #326 from nulltoken/ntk/fix/extern-tag-lightweight
tag: Make git_tag_create_lightweight() accessible to bindings
2011-07-14 06:35:36 -07:00
nulltoken
e5f365051f tag: Make git_tag_create_lightweight() accessible to bindings 2011-07-14 15:11:31 +02:00
Vicent Marti
52e50c1a80 libgit2 v0.14.0, "watermelon wheat"
This a very packed minor release. The usual guilty parties have been
working harder than usual during the holidays -- thanks to everyone
involved!

As always, the updated API docs can be found at:

	http://libgit2.github.com/libgit2/

NEW FEATURES:

	- New OS abstraction layer. This should make all POSIX calls much
	more reliable under Windows.

	- Much faster writes of simple objects (commits, tags, trees) to the
	ODB via in-memory buffering and direct writes, instead of streaming.

	- Unified & simplified API for object creation. All the `create`
	methods now take Objects instead of OIDs to ensure that corrupted
	(dangling) objects cannot be created on the repository.

	- Fully Git-compilant reference renaming (finally!), with
	the already existing `git_reference_rename`.

	- Deletion of config keys with `git_config_delete`

	- Greatly improved index performance when adding new entries

	- Reflog support with the `git_reflog` API

	- Remotes support with the `git_remote` API

	- First parts of the Networking API, including refspecs and
	the transport abstraction layer. (Note that there are no actual
	transports implemented yet)

	- Status support with the `git_status_foreach` and `git_status_file`
	functions.

	- Tons of bugfixes, including the outstanding bug #127 (wrong sort
	ordering when querying tree entries).

KNOWN ISSUES:

	- The reference renaming code leaks memory. This is being worked on
	as part of a reference handling overhaul.

	- The tree-from-index builder has abysmal performance because it
	doesn't handle the Treecache extension yet. This is also being
	worked on.

FULL API CHANGELOG:

	- removed, * modified, + added

	- git_commit_create_o
	- git_commit_create_ov
	- git_reference_create_oid_f
	- git_reference_create_symbolic_f
	- git_reference_rename_f
	- git_tag_create_f
	- git_tag_create_fo
	- git_tag_create_o

	* git_commit_create
	* git_commit_create_v
	* git_config_foreach
	* git_reference_create_oid
	* git_reference_create_symbolic
	* git_reference_rename
	* git_tag_create
	* git_tag_create_frombuffer

	+ git_clearerror
	+ git_config_delete
	+ git_index_uniq
	+ git_odb_hashfile
	+ git_oid_fromstrn
	+ git_reflog_entry_byindex
	+ git_reflog_entry_committer
	+ git_reflog_entry_msg
	+ git_reflog_entry_oidnew
	+ git_reflog_entry_oidold
	+ git_reflog_entrycount
	+ git_reflog_free
	+ git_reflog_read
	+ git_reflog_write
	+ git_refspec_src_match
	+ git_refspec_transform
	+ git_remote_connect
	+ git_remote_fetchspec
	+ git_remote_free
	+ git_remote_get
	+ git_remote_ls
	+ git_remote_name
	+ git_remote_url
	+ git_repository_head_detached
	+ git_repository_head_orphan
	+ git_status_file
	+ git_status_foreach
	+ git_tag_create_lightweight
	+ git_tag_list_match
	+ git_transport_new
2011-07-14 03:26:08 +02:00
Vicent Martí
324f0eecb6 Merge pull request #325 from carlosmn/valgrind
More memory leaks
2011-07-13 18:03:12 -07:00
Vicent Martí
18bdba0e1a Merge pull request #324 from carlosmn/development
typo: one git_remote_fetchspec should be pushspec
2011-07-13 18:02:59 -07:00
Carlos Martín Nieto
1a8167afbc status: don't hide tree closing
It's not obvious that recurse_tree_entries or recurse_tree_entry
should free a resource that wasn't allocated by them. Do this
explicitely and plug a leak while we're at it.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-14 00:06:24 +02:00
Carlos Martín Nieto
91d8a4c077 typo: one git_remote_fetchspec should be pushspec
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-07-13 23:55:48 +02:00
Vicent Martí
8dc91e31f3 Merge pull request #323 from nulltoken/ntk/fix/treebuilder-insert
tree: fix insertion of entries with invalid filenames
2011-07-13 04:38:31 -07:00
nulltoken
f4ad64c109 tree: fix insertion of entries with invalid filenames 2011-07-13 07:58:17 +02:00
Vicent Marti
e6629d8313 tree: More accurate matching on entries
The old matcher was returning fake matches when given stupid entry
names. E.g.

	`git2` could be matched by `git2   /`, `git2/foobar`, git2/////`
	and other stupid stuff
2011-07-13 03:36:03 +02:00
Vicent Marti
761aa2aa35 tree: Fix wrong sort order when querying entries
Fixes #127 (that was quite an outstanding issue).

Rationale:

The tree objects on Git are stored and read following a very specific
sorting algorithm that places folders before files. That original sort
was the sort we were storing on memory, but this sort was being queried
with a binary search that used a simple `strcmp` for comparison, so
there were many instances where the search was failing.

Obviously, the most straightforward way to fix this is changing the
binary search CB to use the same comparison method as the sorting CB.
The problem with this is that the binary search callback compares a path
and an entry, so there is no way to know if the given path is a folder
or a standard file.

How do we work around this? Instead of splitting the `entry_byname`
method in two (one for searching directories and one for searching
normal files), we just assume that the path we are searching for is of
the same kind as the path it's being compared at the moment.

	return git_futils_cmp_path(
		ksearch->filename, ksearch->filename_len, entry->attr & 040000,
        entry->filename, entry->filename_len, entry->attr & 040000);

Since there cannot be a folder and a regular file with the same name on
the same tree, the most basic equality check will always fail
for all comparsions, until our path is compared with the actual entry we
are looking for; in this case, the matching will succeed with the file
type of the entry -- whatever it was initially.

I hope that makes sense.

PS: While I was at it, I switched the cmp methods to use cached values
for the length of each filename. That makes searches and sorts
retardedly fast -- I was wondering the reason of the performance hiccups
on massive trees; it's because of 2*strlen for each comparsion call.
2011-07-13 02:49:47 +02:00