]> git.proxmox.com Git - libgit2.git/log
libgit2.git
13 years agoRemove extra git_index_read from the tests
Carlos Martín Nieto [Tue, 26 Jul 2011 13:53:52 +0000 (15:53 +0200)]
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>
13 years agofilebuf: update git_filebuf.write signature to take non-const buffer
Kirill A. Shutemov [Mon, 18 Jul 2011 02:11:18 +0000 (05:11 +0300)]
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>
13 years agoindex: rework index entry initialization routine
Kirill A. Shutemov [Mon, 18 Jul 2011 01:27:56 +0000 (04:27 +0300)]
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>
13 years agoindex: rework index_insert()
Kirill A. Shutemov [Mon, 18 Jul 2011 01:16:42 +0000 (04:16 +0300)]
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>
13 years agoindex: introduce index_entry_free()
Kirill A. Shutemov [Mon, 18 Jul 2011 01:01:27 +0000 (04:01 +0300)]
index: introduce index_entry_free()

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoindex: extract index_entry_dup() from index_insert()
Kirill A. Shutemov [Mon, 18 Jul 2011 00:53:24 +0000 (03:53 +0300)]
index: extract index_entry_dup() from index_insert()

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoindex: fix cast warnings
Kirill A. Shutemov [Fri, 15 Jul 2011 14:46:55 +0000 (17:46 +0300)]
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>
13 years agotests: fix cast warnings
Kirill A. Shutemov [Fri, 15 Jul 2011 15:34:20 +0000 (18:34 +0300)]
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>
13 years agorefs: fix cast warning
Kirill A. Shutemov [Fri, 15 Jul 2011 15:24:35 +0000 (18:24 +0300)]
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>
13 years agotree: fix cast warnings
Kirill A. Shutemov [Fri, 15 Jul 2011 14:56:48 +0000 (17:56 +0300)]
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>
13 years agoposix: declare 'buf' argument of p_write() as const
Kirill A. Shutemov [Fri, 15 Jul 2011 14:31:24 +0000 (17:31 +0300)]
posix: declare 'buf' argument of p_write() as const

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoodb_pack: fix cast warnings
Kirill A. Shutemov [Fri, 15 Jul 2011 13:44:25 +0000 (16:44 +0300)]
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>
13 years agosha1: fix cast warnings
Kirill A. Shutemov [Fri, 15 Jul 2011 12:37:15 +0000 (15:37 +0300)]
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>
13 years agorevwalk: fix cast warning
Kirill A. Shutemov [Fri, 15 Jul 2011 12:31:17 +0000 (15:31 +0300)]
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>
13 years agotransport_local: fix cast warnings
Kirill A. Shutemov [Fri, 15 Jul 2011 12:29:13 +0000 (15:29 +0300)]
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>
13 years agoreflog: fix cast warning
Kirill A. Shutemov [Fri, 15 Jul 2011 12:07:59 +0000 (15:07 +0300)]
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>
13 years agocommit: fix cast warnings
Kirill A. Shutemov [Fri, 15 Jul 2011 11:59:37 +0000 (14:59 +0300)]
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>
13 years agoMerge pull request #336 from schu/cleanup
Vicent Martí [Mon, 25 Jul 2011 19:10:10 +0000 (12:10 -0700)]
Merge pull request #336 from schu/cleanup

repository.c: remove obsolete TODO marker

13 years agoMerge pull request #337 from belkiss/development
Vicent Martí [Mon, 25 Jul 2011 19:02:20 +0000 (12:02 -0700)]
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.

13 years agoModify struct definition to enable forward declare with C++ compiler,
Lambert CLARA [Mon, 25 Jul 2011 18:23:23 +0000 (20:23 +0200)]
Modify struct definition to enable forward declare with C++ compiler,
thus avoid including C library's header in C++ header.

13 years agorepository.c: remove obsolete TODO marker
schu [Sun, 24 Jul 2011 13:58:10 +0000 (15:58 +0200)]
repository.c: remove obsolete TODO marker

Signed-off-by: schu <schu-github@schulog.org>
13 years agoreadme: Add hgit2 to the list of bindings
Vicent Marti [Fri, 22 Jul 2011 02:24:07 +0000 (04:24 +0200)]
readme: Add hgit2 to the list of bindings

13 years agoMerge pull request #334 from schu/typos
Vicent Martí [Fri, 22 Jul 2011 02:21:19 +0000 (19:21 -0700)]
Merge pull request #334 from schu/typos

tag.c: fix tiny typo

13 years agoMerge pull request #332 from kiryl/leaks
Vicent Martí [Fri, 22 Jul 2011 02:20:52 +0000 (19:20 -0700)]
Merge pull request #332 from kiryl/leaks

Fix two memory leaks pointed by valgrind

13 years agotag.c: fix tiny typo
schu [Wed, 20 Jul 2011 09:36:05 +0000 (11:36 +0200)]
tag.c: fix tiny typo

Signed-off-by: schu <schu-github@schulog.org>
13 years agoindex: fix memory leak
Kirill A. Shutemov [Sun, 17 Jul 2011 23:05:23 +0000 (02:05 +0300)]
index: fix memory leak

We need really free vectors on index freeing, not only clear.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agorefs: fix memory leak on rename
Kirill A. Shutemov [Sun, 17 Jul 2011 22:54:40 +0000 (01:54 +0300)]
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>
13 years agoMerge pull request #327 from carlosmn/solaris
Vicent Martí [Sun, 17 Jul 2011 19:01:22 +0000 (12:01 -0700)]
Merge pull request #327 from carlosmn/solaris

net: link necessary libraries in Solaris

13 years agonet: link necessary libraries in Solaris
Carlos Martín Nieto [Thu, 14 Jul 2011 15:05:22 +0000 (17:05 +0200)]
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>
13 years agoMerge pull request #326 from nulltoken/ntk/fix/extern-tag-lightweight
Vicent Martí [Thu, 14 Jul 2011 13:35:36 +0000 (06:35 -0700)]
Merge pull request #326 from nulltoken/ntk/fix/extern-tag-lightweight

tag: Make git_tag_create_lightweight() accessible to bindings

13 years agotag: Make git_tag_create_lightweight() accessible to bindings
nulltoken [Thu, 14 Jul 2011 13:11:31 +0000 (15:11 +0200)]
tag: Make git_tag_create_lightweight() accessible to bindings

13 years agolibgit2 v0.14.0, "watermelon wheat"
Vicent Marti [Wed, 13 Jul 2011 22:01:48 +0000 (00:01 +0200)]
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

13 years agoMerge pull request #325 from carlosmn/valgrind
Vicent Martí [Thu, 14 Jul 2011 01:03:12 +0000 (18:03 -0700)]
Merge pull request #325 from carlosmn/valgrind

More memory leaks

13 years agoMerge pull request #324 from carlosmn/development
Vicent Martí [Thu, 14 Jul 2011 01:02:59 +0000 (18:02 -0700)]
Merge pull request #324 from carlosmn/development

typo: one git_remote_fetchspec should be pushspec

13 years agostatus: don't hide tree closing
Carlos Martín Nieto [Wed, 13 Jul 2011 22:04:24 +0000 (00:04 +0200)]
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>
13 years agotypo: one git_remote_fetchspec should be pushspec
Carlos Martín Nieto [Sat, 9 Jul 2011 15:29:42 +0000 (17:29 +0200)]
typo: one git_remote_fetchspec should be pushspec

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
13 years agoMerge pull request #323 from nulltoken/ntk/fix/treebuilder-insert
Vicent Martí [Wed, 13 Jul 2011 11:38:31 +0000 (04:38 -0700)]
Merge pull request #323 from nulltoken/ntk/fix/treebuilder-insert

tree: fix insertion of entries with invalid filenames

13 years agotree: fix insertion of entries with invalid filenames
nulltoken [Wed, 13 Jul 2011 05:58:17 +0000 (07:58 +0200)]
tree: fix insertion of entries with invalid filenames

13 years agotree: More accurate matching on entries
Vicent Marti [Wed, 13 Jul 2011 01:36:03 +0000 (03:36 +0200)]
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

13 years agotree: Fix wrong sort order when querying entries
Vicent Marti [Wed, 13 Jul 2011 00:49:47 +0000 (02:49 +0200)]
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.

13 years agoindex: Yes, we have to truncate
Vicent Marti [Wed, 13 Jul 2011 00:15:31 +0000 (02:15 +0200)]
index: Yes, we have to truncate

13 years agoindex: fix potential overflow
Kirill A. Shutemov [Tue, 12 Jul 2011 17:29:12 +0000 (20:29 +0300)]
index: fix potential overflow

mode field of git_index_entry_unmerged is array of unsigned ints. It's
unsafe to cast pointer to an element of the array to long int *. It may
cause overflow in git_strtol32().

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoindex: drop useless type casting
Kirill A. Shutemov [Tue, 12 Jul 2011 16:53:51 +0000 (19:53 +0300)]
index: drop useless type casting

Type casting usually points to some trick or bug. It's better not hide
it between useless type castings.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agovector: mark internal functions as static
Kirill A. Shutemov [Tue, 12 Jul 2011 16:33:30 +0000 (19:33 +0300)]
vector: mark internal functions as static

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agovector: avoid double asserting
Kirill A. Shutemov [Tue, 12 Jul 2011 16:01:09 +0000 (19:01 +0300)]
vector: avoid double asserting

index_initialize() calls assert() for arguments on its own. No need to
call it twice.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoindex: drop sort_index()
Kirill A. Shutemov [Tue, 12 Jul 2011 15:56:40 +0000 (18:56 +0300)]
index: drop sort_index()

Remove dummy wrapper around git_vector_sort().

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoindex: do not sort index before git_vector_bsearch2()
Kirill A. Shutemov [Tue, 12 Jul 2011 15:37:27 +0000 (18:37 +0300)]
index: do not sort index before git_vector_bsearch2()

git_vector_bsearch2() calls git_vector_sort(). No need to call it
directly.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoindex: do not free vectors twice in git_index_free()
Kirill A. Shutemov [Tue, 12 Jul 2011 15:30:34 +0000 (18:30 +0300)]
index: do not free vectors twice in git_index_free()

git_index_clear() frees index->entries and index->unmerged. No need to
free it once again.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoFree sig in reflog test
Carlos Martín Nieto [Tue, 12 Jul 2011 18:46:07 +0000 (20:46 +0200)]
Free sig in reflog test

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
13 years agostatus: refactor the tests to remove some code duplication
nulltoken [Tue, 12 Jul 2011 09:29:36 +0000 (11:29 +0200)]
status: refactor the tests to remove some code duplication

13 years agoMerge pull request #321 from letolabs/readme
Vicent Martí [Tue, 12 Jul 2011 18:26:25 +0000 (11:26 -0700)]
Merge pull request #321 from letolabs/readme

Add parrot-libgit2 to the list of language bindings in the readme

13 years agoMerge pull request #319 from carlosmn/valgrind
Vicent Martí [Tue, 12 Jul 2011 18:23:12 +0000 (11:23 -0700)]
Merge pull request #319 from carlosmn/valgrind

Fix more memory leaks

13 years agoMerge pull request #318 from schu/ref-fix-leak
Vicent Martí [Tue, 12 Jul 2011 18:22:11 +0000 (11:22 -0700)]
Merge pull request #318 from schu/ref-fix-leak

reference_rename: make sure old_name gets freed

13 years agoAdd parrot-libgit2 to the list of language bindings in the readme
Jonathan "Duke" Leto [Tue, 12 Jul 2011 18:19:42 +0000 (11:19 -0700)]
Add parrot-libgit2 to the list of language bindings in the readme

13 years agostatus: plug some leaks
Carlos Martín Nieto [Tue, 12 Jul 2011 16:08:46 +0000 (18:08 +0200)]
status: plug some leaks

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoDon't leak the buf when testing it
Carlos Martín Nieto [Tue, 12 Jul 2011 16:10:31 +0000 (18:10 +0200)]
Don't leak the buf when testing it

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoreference_rename: make sure old_name gets freed
schu [Tue, 12 Jul 2011 15:53:22 +0000 (17:53 +0200)]
reference_rename: make sure old_name gets freed

Signed-off-by: schu <schu-github@schulog.org>
13 years agoconfig: Rename `del` to `delete
Vicent Marti [Tue, 12 Jul 2011 00:38:20 +0000 (02:38 +0200)]
config: Rename `del` to `delete

13 years agotag: Add creation of lightweight tag
nulltoken [Mon, 11 Jul 2011 14:30:46 +0000 (16:30 +0200)]
tag: Add creation of lightweight tag

13 years agoWhat the fuck was this doing in `src`?
Vicent Marti [Mon, 11 Jul 2011 17:28:07 +0000 (19:28 +0200)]
What the fuck was this doing in `src`?

13 years agoMerge pull request #315 from belkiss/development
Vicent Martí [Mon, 11 Jul 2011 11:19:46 +0000 (04:19 -0700)]
Merge pull request #315 from belkiss/development

Finish to hide git_pkt from external API.

13 years agoFinish to hide git_pkt from external API.
Lambert CLARA [Mon, 11 Jul 2011 11:04:36 +0000 (13:04 +0200)]
Finish to hide git_pkt from external API.

13 years agoMerge pull request #314 from nulltoken/ntk/fix-reflog
Vicent Martí [Mon, 11 Jul 2011 01:02:33 +0000 (18:02 -0700)]
Merge pull request #314 from nulltoken/ntk/fix-reflog

reflog: Fix reflog writer/reader

13 years agoRemove the last reference of git_net_direction enum
Lambert CLARA [Sat, 9 Jul 2011 12:53:00 +0000 (14:53 +0200)]
Remove the last reference of git_net_direction enum

13 years agoCleanup external API
Vicent Marti [Mon, 11 Jul 2011 00:58:00 +0000 (02:58 +0200)]
Cleanup external API

Some of the WIP API calls have been hidden in preparation for the next
minor release.

13 years agoinclude: Fix unmatched params in documentation
Vicent Marti [Sat, 9 Jul 2011 13:13:32 +0000 (15:13 +0200)]
include: Fix unmatched params in documentation

13 years agoreflog: Fix reflog writer/reader
nulltoken [Sun, 10 Jul 2011 05:48:52 +0000 (07:48 +0200)]
reflog: Fix reflog writer/reader

 - Use a space to separate oids and signature
 - Enforce test coverage
 - Make test run in a temporary folder in order not to alter the test repository

13 years agoMerge pull request #312 from nulltoken/patch-2
Vicent Martí [Sat, 9 Jul 2011 13:45:30 +0000 (06:45 -0700)]
Merge pull request #312 from nulltoken/patch-2

Fix MSVC compilation warning

13 years agoFix MSVC compilation warning
nulltoken [Sat, 9 Jul 2011 13:36:18 +0000 (06:36 -0700)]
Fix MSVC compilation warning

13 years agostatus: Cleanup
Vicent Marti [Sat, 9 Jul 2011 13:05:14 +0000 (15:05 +0200)]
status: Cleanup

The `hashfile` function has been moved to ODB, next to `git_odb_hash`.

Global state has been removed from the dirent call in `status.c`,
because global state is killing the rainforest and causing global
warming.

13 years agostatus: nonexistent file with git_status_file()
Jason Penny [Sat, 9 Jul 2011 04:08:52 +0000 (00:08 -0400)]
status: nonexistent file with git_status_file()

Throws GIT_ENOTFOUND error if given a filename that is not in
HEAD, index, nor the work tree.

13 years agostatus: consolidate some test code
Jason Penny [Sat, 9 Jul 2011 03:51:05 +0000 (23:51 -0400)]
status: consolidate some test code

Refactored copy of test repo to a function.

13 years agostatus: handle subdirs for git_status_file
Jason Penny [Sat, 25 Jun 2011 00:36:53 +0000 (20:36 -0400)]
status: handle subdirs for git_status_file

13 years agostatus: add subdir to test repo
Jason Penny [Fri, 24 Jun 2011 22:35:06 +0000 (18:35 -0400)]
status: add subdir to test repo

13 years agostatus: get status for single file
Jason Penny [Thu, 23 Jun 2011 22:51:22 +0000 (18:51 -0400)]
status: get status for single file

Add git_status_file to be able to retrieve status of single file by
supplying a path.

13 years agostatus: get file statuses and run callback
Jason Penny [Wed, 22 Jun 2011 22:31:20 +0000 (18:31 -0400)]
status: get file statuses and run callback

Add git_status_foreach() to run a callback on each file passing the path
and a status value.

13 years agostatus: new test repo
Jason Penny [Wed, 22 Jun 2011 22:23:57 +0000 (18:23 -0400)]
status: new test repo

13 years agostatus: get blob object id of file on disk
Jason Penny [Wed, 22 Jun 2011 22:19:46 +0000 (18:19 -0400)]
status: get blob object id of file on disk

Add git_status_hashfile() to get blob's object id for a file without adding
it to the object database or needing a repository at all.
This functionality is similar to `git hash-object` without '-w'.

13 years agoUpdate tests/NAMING
Jason Penny [Sat, 9 Jul 2011 02:44:15 +0000 (22:44 -0400)]
Update tests/NAMING

13 years agotsort: Remove unused CLZ methods
Vicent Marti [Sat, 9 Jul 2011 11:27:08 +0000 (13:27 +0200)]
tsort: Remove unused CLZ methods

13 years agoMerge pull request #311 from nulltoken/ntk/fix-win32-specs
Vicent Martí [Sat, 9 Jul 2011 11:24:23 +0000 (04:24 -0700)]
Merge pull request #311 from nulltoken/ntk/fix-win32-specs

Ntk/fix win32 specs

13 years agowin32: replace usage of _MSV_VER with _MSC_VER
nulltoken [Sat, 9 Jul 2011 06:41:02 +0000 (08:41 +0200)]
win32: replace usage of _MSV_VER with _MSC_VER

13 years agoFix MSVC compilation warning
nulltoken [Sat, 9 Jul 2011 06:36:37 +0000 (08:36 +0200)]
Fix MSVC compilation warning

13 years agoRemove unused methods
Vicent Marti [Sat, 9 Jul 2011 00:37:16 +0000 (02:37 +0200)]
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.

13 years agoodb: Direct writes are back
Vicent Marti [Sat, 9 Jul 2011 00:10:46 +0000 (02:10 +0200)]
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.

13 years agoposix: Portable `vsnprintf`
Vicent Marti [Fri, 8 Jul 2011 21:01:37 +0000 (23:01 +0200)]
posix: Portable `vsnprintf`

Our good, lovely folks at Microsoft decided that there was no good
reason to make `vsnprintf` compilant with the C standard, so that
function in Windows returns -1 on overflow, instead of returning the
actual byte count needed to write the full string.

We now handle this situation more gracefully with the POSIX
compatibility layer, by returning the needed byte size using an
auxiliary method instead of blindly resizing the target buffer until it
fits.

This means we can now support `printf`s of any size by allocating a
temporary buffer. That's good.

13 years agosignature: Fix optional header
Vicent Marti [Fri, 8 Jul 2011 16:31:05 +0000 (18:31 +0200)]
signature: Fix optional header

13 years agoreflog: add API to read or write a reference log
schu [Tue, 28 Jun 2011 12:13:12 +0000 (14:13 +0200)]
reflog: add API to read or write a reference log

So far libgit2 didn't support reference logs (reflog). Add a new
git_reflog_* API for basic reading and writing of reflogs:

* git_reflog_read
* git_reflog_write
* git_reflog_free

Signed-off-by: schu <schu-github@schulog.org>
13 years agogit_signature__write: make header optionally
schu [Sun, 19 Jun 2011 21:06:53 +0000 (23:06 +0200)]
git_signature__write: make header optionally

Signed-off-by: schu <schu-github@schulog.org>
13 years agoindex: Return `GIT_ENOTFOUND` when an entry cannot be opened
Vicent Marti [Fri, 8 Jul 2011 16:22:44 +0000 (18:22 +0200)]
index: Return `GIT_ENOTFOUND` when an entry cannot be opened

13 years agoMerge pull request #309 from schu/rr-flaw
Vicent Martí [Fri, 8 Jul 2011 16:21:30 +0000 (09:21 -0700)]
Merge pull request #309 from schu/rr-flaw

reference_rename: fix flaw in force-renaming

13 years agoMerge pull request #308 from schu/unused-but-set-var
Vicent Martí [Fri, 8 Jul 2011 16:21:13 +0000 (09:21 -0700)]
Merge pull request #308 from schu/unused-but-set-var

tsort: remove unused but set variable

13 years agoreference_rename: fix flaw in force-renaming
schu [Thu, 7 Jul 2011 19:24:12 +0000 (21:24 +0200)]
reference_rename: fix flaw in force-renaming

reference_rename didn't respect the force flag. Fixed.

Reported-by: nulltoken <emeric.fermas@gmail.com>
Signed-off-by: schu <schu-github@schulog.org>
13 years agoreference_renaming: add additional tests
nulltoken [Thu, 7 Jul 2011 15:49:55 +0000 (17:49 +0200)]
reference_renaming: add additional tests

Add some more test checking forced reference renaming.

Signed-off-by: nulltoken <emeric.fermas@gmail.com>
Acked-by: schu <schu-github@schulog.org>
13 years agotsort: remove unused but set variable
schu [Thu, 7 Jul 2011 16:14:53 +0000 (18:14 +0200)]
tsort: remove unused but set variable

Signed-off-by: schu <schu-github@schulog.org>
13 years agoindex: Fix memory leak on OOM
Vicent Marti [Thu, 7 Jul 2011 15:56:10 +0000 (17:56 +0200)]
index: Fix memory leak on OOM

13 years agotag: add pattern based retrieval of list of tag names
nulltoken [Thu, 7 Jul 2011 11:47:45 +0000 (13:47 +0200)]
tag: add pattern based retrieval of list of tag names

13 years agotsort: fix wrong header inclusion
nulltoken [Thu, 7 Jul 2011 11:38:47 +0000 (13:38 +0200)]
tsort: fix wrong header inclusion

13 years agotest-core: Fix warning in uniq test
Vicent Marti [Thu, 7 Jul 2011 10:23:47 +0000 (12:23 +0200)]
test-core: Fix warning in uniq test

13 years agoFix MSVC compilation warnings
nulltoken [Thu, 7 Jul 2011 08:11:00 +0000 (10:11 +0200)]
Fix MSVC compilation warnings