summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * | Add git_vector_foreachCarlos Martín Nieto2011-08-021-0/+3
| | | | | | | | | | | | | | | | | | You can use it just as you'd use a for-loop Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | Modify the given offset in git_packfile_unpackCarlos Martín Nieto2011-08-024-107/+90
| | | | | | | | | | | | | | | | | | | | | | | | The callers immediately throw away the offset, so we don't need any logical changes in any of them. This will be useful for the indexer, as it does need to know where the compressed data ends. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | Move pack functions to their own fileCarlos Martín Nieto2011-08-024-557/+534
| | |
| * | Make packfile_unpack_header more genericCarlos Martín Nieto2011-08-026-374/+360
| | | | | | | | | | | | | | | | | | On the way, store the fd and the size in the mwindow file. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | Rename stuff to git_indexer_Carlos Martín Nieto2011-08-021-9/+98
| | | | | | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | Start the runnerCarlos Martín Nieto2011-08-021-0/+34
| | | | | | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | Intial indexer codeCarlos Martín Nieto2011-08-021-0/+133
| | |
| * | Move the pack structs to an internal headerCarlos Martín Nieto2011-08-022-59/+95
| | |
| * | Factor out the mmap window codeCarlos Martín Nieto2011-08-023-227/+372
| | | | | | | | | | | | | | | | | | | | | This code is useful for more things than just the packfile handling code. Factor it out so it can be reused. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | | Merge pull request #349 from MasterGrumpy/developmentVicent Martí2011-08-032-5/+1
|\ \ \ | | | | | | | | git_status_foreach issue
| * | | Remove duplicated sortLuc Bertrand2011-08-032-2/+0
| | | |
| * | | remove unused variableLuc Bertrand2011-08-031-2/+0
| | | |
| * | | fix recurse_tree_entries, continue parsing tree after first subdirectory foundLuc Bertrand2011-08-031-1/+1
| |/ /
* | | signature: adjust API to return error codesschu2011-08-031-7/+25
| | | | | | | | | | | | | | | | | | | | | | | | git_signature_new() and git_signature_now() currently don't return error codes. Change the API to return error codes and not pointers to let the user handle errors properly. Signed-off-by: schu <schu-github@schulog.org>
* | | signature.c: fix off-by-one errorschu2011-08-031-1/+1
|/ / | | | | | | Signed-off-by: schu <schu-github@schulog.org>
* | Fix memory leak when wrong object type is looked up from cacheLambert CLARA2011-08-021-0/+3
| | | | | | | | Update unit test accordingly : no need to close
* | reflog: avoid users writing a wrong ancestor OIDschu2011-08-011-15/+16
| | | | | | | | | | | | | | Disallow NULL as ancestor OID when writing a reflog entry for an existing reference. Signed-off-by: schu <schu-github@schulog.org>
* | Merge pull request #335 from carlosmn/read-updatedVicent Martí2011-07-284-77/+92
|\ \ | | | | | | Don't stat so much when reading references
| * | index: use git_futils_readbuffer_updatedCarlos Martín Nieto2011-07-231-16/+11
| | | | | | | | | | | | | | | | | | This helps readability a bit as well. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
| * | refs: don't stat so muchCarlos Martín Nieto2011-07-231-53/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Add git_futils_readbuffer_updatedCarlos Martín Nieto2011-07-232-8/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | filebuf: update git_filebuf.write signature to take non-const bufferKirill A. Shutemov2011-07-252-20/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | index: rework index entry initialization routineKirill A. Shutemov2011-07-251-56/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | index: rework index_insert()Kirill A. Shutemov2011-07-251-22/+42
| | | | | | | | | | | | | | | | | | Now index_insert() takes copy of index entry, not coping it by itself. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | | index: introduce index_entry_free()Kirill A. Shutemov2011-07-251-4/+10
| | | | | | | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | | index: extract index_entry_dup() from index_insert()Kirill A. Shutemov2011-07-251-9/+20
| | | | | | | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | | index: fix cast warningsKirill A. Shutemov2011-07-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /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>
* | | refs: fix cast warningKirill A. Shutemov2011-07-251-2/+2
| | | | | | | | | | | | | | | | | | | | | /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>
* | | tree: fix cast warningsKirill A. Shutemov2011-07-251-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | /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>
* | | posix: declare 'buf' argument of p_write() as constKirill A. Shutemov2011-07-252-3/+3
| | | | | | | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | | odb_pack: fix cast warningsKirill A. Shutemov2011-07-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /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>
* | | sha1: fix cast warningsKirill A. Shutemov2011-07-251-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /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>
* | | revwalk: fix cast warningKirill A. Shutemov2011-07-251-2/+1
| | | | | | | | | | | | | | | | | | | | | /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>
* | | transport_local: fix cast warningsKirill A. Shutemov2011-07-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | reflog: fix cast warningKirill A. Shutemov2011-07-251-2/+2
| | | | | | | | | | | | | | | | | | | | | /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>
* | | commit: fix cast warningsKirill A. Shutemov2011-07-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | /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>
* | | repository.c: remove obsolete TODO markerschu2011-07-241-1/+1
|/ / | | | | | | Signed-off-by: schu <schu-github@schulog.org>
* | Merge pull request #334 from schu/typosVicent Martí2011-07-211-4/+4
|\ \ | | | | | | tag.c: fix tiny typo
| * | tag.c: fix tiny typoschu2011-07-201-4/+4
| |/ | | | | | | Signed-off-by: schu <schu-github@schulog.org>
* | index: fix memory leakKirill A. Shutemov2011-07-191-0/+2
| | | | | | | | | | | | We need really free vectors on index freeing, not only clear. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | refs: fix memory leak on renameKirill A. Shutemov2011-07-191-2/+9
|/ | | | | | | | | | | | | | 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>
* Merge pull request #325 from carlosmn/valgrindVicent Martí2011-07-131-3/+4
|\ | | | | More memory leaks
| * status: don't hide tree closingCarlos Martín Nieto2011-07-141-3/+4
| | | | | | | | | | | | | | | | 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>
* | tree: fix insertion of entries with invalid filenamesnulltoken2011-07-131-3/+5
| |
* | tree: More accurate matching on entriesVicent Marti2011-07-131-11/+28
| | | | | | | | | | | | | | | | 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
* | tree: Fix wrong sort order when querying entriesVicent Marti2011-07-131-15/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | index: Yes, we have to truncateVicent Marti2011-07-131-3/+13
| |
* | index: fix potential overflowKirill A. Shutemov2011-07-131-2/+6
| | | | | | | | | | | | | | | | 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>
* | index: drop useless type castingKirill A. Shutemov2011-07-131-23/+18
| | | | | | | | | | | | | | 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>
* | vector: mark internal functions as staticKirill A. Shutemov2011-07-131-5/+5
| | | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>