summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | vector: avoid double assertingKirill A. Shutemov2011-07-131-3/+0
| | | | | | | | | | | | | | index_initialize() calls assert() for arguments on its own. No need to call it twice. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | index: drop sort_index()Kirill A. Shutemov2011-07-131-11/+3
| | | | | | | | | | | | Remove dummy wrapper around git_vector_sort(). Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | index: do not sort index before git_vector_bsearch2()Kirill A. Shutemov2011-07-131-1/+0
| | | | | | | | | | | | | | git_vector_bsearch2() calls git_vector_sort(). No need to call it directly. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | index: do not free vectors twice in git_index_free()Kirill A. Shutemov2011-07-131-2/+0
|/ | | | | | | 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>
* Merge pull request #319 from carlosmn/valgrindVicent Martí2011-07-121-1/+7
|\ | | | | Fix more memory leaks
| * status: plug some leaksCarlos Martín Nieto2011-07-121-1/+7
| | | | | | | | Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* | reference_rename: make sure old_name gets freedschu2011-07-121-1/+3
|/ | | | Signed-off-by: schu <schu-github@schulog.org>
* config: Rename `del` to `deleteVicent Marti2011-07-121-1/+1
|
* tag: Add creation of lightweight tagnulltoken2011-07-111-20/+65
|
* What the fuck was this doing in `src`?Vicent Marti2011-07-111-344/+0
|
* Finish to hide git_pkt from external API.Lambert CLARA2011-07-111-4/+4
|
* Merge pull request #314 from nulltoken/ntk/fix-reflogVicent Martí2011-07-105-10/+12
|\ | | | | reflog: Fix reflog writer/reader
| * reflog: Fix reflog writer/readernulltoken2011-07-105-10/+12
| | | | | | | | | | | | - 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
* | Cleanup external APIVicent Marti2011-07-113-3/+66
|/ | | | | Some of the WIP API calls have been hidden in preparation for the next minor release.
* Fix MSVC compilation warningnulltoken2011-07-091-1/+1
|
* status: CleanupVicent Marti2011-07-092-66/+78
| | | | | | | | 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.
* status: nonexistent file with git_status_file()Jason Penny2011-07-091-2/+7
| | | | | Throws GIT_ENOTFOUND error if given a filename that is not in HEAD, index, nor the work tree.
* status: handle subdirs for git_status_fileJason Penny2011-07-091-7/+30
|
* status: get status for single fileJason Penny2011-07-091-19/+112
| | | | | Add git_status_file to be able to retrieve status of single file by supplying a path.
* status: get file statuses and run callbackJason Penny2011-07-091-0/+193
| | | | | Add git_status_foreach() to run a callback on each file passing the path and a status value.
* status: get blob object id of file on diskJason Penny2011-07-091-0/+77
| | | | | | 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'.
* tsort: Remove unused CLZ methodsVicent Marti2011-07-091-19/+0
|
* win32: replace usage of _MSV_VER with _MSC_VERnulltoken2011-07-093-3/+3
|
* Fix MSVC compilation warningnulltoken2011-07-091-1/+1
|
* Remove unused methodsVicent Marti2011-07-098-74/+23
| | | | | | | | | 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.
* odb: Direct writes are backVicent Marti2011-07-0912-98/+244
| | | | | | | | | | | | | | | | | | | | | | 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.
* posix: Portable `vsnprintf`Vicent Marti2011-07-094-12/+42
| | | | | | | | | | | | | | | 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.
* signature: Fix optional headerVicent Marti2011-07-093-14/+8
|
* reflog: add API to read or write a reference logschu2011-07-092-0/+308
| | | | | | | | | | | 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>
* git_signature__write: make header optionallyschu2011-07-091-4/+10
| | | | Signed-off-by: schu <schu-github@schulog.org>
* index: Return `GIT_ENOTFOUND` when an entry cannot be openedVicent Marti2011-07-092-1/+4
|
* Merge pull request #309 from schu/rr-flawVicent Martí2011-07-081-2/+6
|\ | | | | reference_rename: fix flaw in force-renaming
| * reference_rename: fix flaw in force-renamingschu2011-07-071-2/+6
| | | | | | | | | | | | | | reference_rename didn't respect the force flag. Fixed. Reported-by: nulltoken <emeric.fermas@gmail.com> Signed-off-by: schu <schu-github@schulog.org>
* | tsort: remove unused but set variableschu2011-07-071-3/+1
|/ | | | Signed-off-by: schu <schu-github@schulog.org>
* index: Fix memory leak on OOMVicent Marti2011-07-071-4/+17
|
* tag: add pattern based retrieval of list of tag namesnulltoken2011-07-071-4/+28
|
* tsort: fix wrong header inclusionnulltoken2011-07-071-7/+1
|
* Fix MSVC compilation warningsnulltoken2011-07-072-5/+10
|
* vector: Timsort all of the thingsVicent Marti2011-07-0710-81/+423
| | | | | | | | | | | | | | | | | | | | | | | | Drop the GLibc implementation of Merge Sort and replace it with Timsort. The algorithm has been tuned to work on arrays of pointers (void **), so there's no longer a need to abstract the byte-width of each element in the array. All the comparison callbacks now take pointers-to-elements, not pointers-to-pointers, so there's now one less level of dereferencing. E.g. int index_cmp(const void *a, const void *b) { - const git_index_entry *entry_a = *(const git_index_entry **)(a); + const git_index_entry *entry_a = (const git_index_entry *)(a); The result is up to a 40% speed-up when sorting vectors. Memory usage remains lineal. A new `bsearch` implementation has been added, whose callback also supplies pointer-to-elements, to uniform the Vector API again.
* Merge pull request #306 from carlosmn/developmentVicent Martí2011-07-062-11/+2
|\ | | | | Fix network MSYS compilation
| * Fix network MSYS compilationCarlos Martín Nieto2011-07-062-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | MSYS/MinGW uses winsock but obviously doesn't set _MSC_VER. Use _WIN32 to decide whether to use winsock or BSD headers. Also remove these headers from src/transport_git.c altogether, as they are not needed. MSYS is very conservative, so we have to tell it that we don't care about versions of Windows lower than WindowsXP. We also need to tell CMake to add ws2_32 to the libraries list and we shouldn't add the -fPIC option, to MSYS because it complains that it does it anyway. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | Merge pull request #296 from kiryl/index-optimizationVicent Martí2011-07-065-18/+112
|\ \ | | | | | | Index optimization
| * | index: introduce git_index_uniq() functionKirill A. Shutemov2011-07-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | It removes all entries with equal path except last added. On large indexes git_index_append() + git_index_uniq() before writing is *much* faster, than git_index_add(). Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
| * | vector: implement git_vector_uniq()Kirill A. Shutemov2011-07-052-1/+21
| | | | | | | | | | | | | | | | | | | | | The routine remove duplictes from the vector. Only the last added element of elements with equal keys remains in the vector. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
| * | vector, index: use git__msort() for vector sortingKirill A. Shutemov2011-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Index operation use git_vector_sort() to sort index entries. Since index support adding duplicates (two or more entries with the same path), it's important to preserve order of elements. Preserving order of elements allows to make decisions based on order. For example it's possible to implement function witch removes all duplicates except last added. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
| * | util: introduce merge sort routineKirill A. Shutemov2011-07-052-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases it's important to preserve order of elements with equal keys (stable sort). qsort(3) doesn't define order of elements with equal keys. git__msort() implements merge sort which is stable sort. Implementation taken from git. Function renamed git_qsort() -> git__msort(). Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
| * | index: speedup git_index_append()/git_index_append2()Kirill A. Shutemov2011-07-051-17/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git_index_find() in index_insert() is useless if replace is not requested (append). Do not call it in this case. It speedup git_index_append() *dramatically* on large indexes. $ cat index_test.c int main(int argc, char **argv) { git_index *index; git_repository *repo; git_odb *odb; struct git_index_entry entry; git_oid tree_oid; char tree_hex[41]; int i; git_repository_init(&repo, "/tmp/myrepo", 0); odb = git_repository_database(repo); git_repository_index(&index, repo); memset(&entry, 0, sizeof(entry)); git_odb_write(&entry.oid, odb, "", 0, GIT_OBJ_BLOB); entry.path = "test.file"; for (i = 0; i < 50000; i++) git_index_append2(index, &entry); git_tree_create_fromindex(&tree_oid, index); git_oid_fmt(tree_hex, &tree_oid); tree_hex[40] = '\0'; printf("tree: %s\n", tree_hex); git_index_free(index); git_repository_free(repo); return 0; } Before: $ time ./index_test tree: 43f73659c43b651588cc81459d9e25b08721b95d ./index_test 151.19s user 0.05s system 99% cpu 2:31.78 total After: $ time ./index_test tree: 43f73659c43b651588cc81459d9e25b08721b95d ./index_test 0.05s user 0.00s system 94% cpu 0.059 total About 2573 times speedup on this test :) Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | | revwalk: Properly mark uninteresting commitsVicent Marti2011-07-061-8/+6
| | |
* | | refs: Cleanup reference renamingVicent Marti2011-07-063-36/+33
| | | | | | | | | | | | | | | | | | | | | `git_futils_rmdir_r`: rename, clean up. `git_reference_rename`: cleanup. Do not use 3x4096 buffers on the stack or things will get ugly very fast. We can reuse the same buffer.
* | | Remove duplicated recursive directory removal related codenulltoken2011-07-062-8/+10
| | |