diff options
| author | Kirill A. Shutemov <kirill@shutemov.name> | 2011-07-02 01:08:42 +0300 |
|---|---|---|
| committer | Kirill A. Shutemov <kirill@shutemov.name> | 2011-07-05 17:52:39 +0300 |
| commit | 245adf4f3cc1d47352e626ef53372d07761d84cf (patch) | |
| tree | 5efc730cc37ada82ad4a1e927bc7f1d3a7877a41 /src/index.c | |
| parent | 476c42acc554e7b3f79c945c2a461d4e25dde41c (diff) | |
| download | libgit2-245adf4f3cc1d47352e626ef53372d07761d84cf.tar.gz | |
index: introduce git_index_uniq() function
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>
Diffstat (limited to 'src/index.c')
| -rw-r--r-- | src/index.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/index.c b/src/index.c index fd905d007..dd33db92a 100644 --- a/src/index.c +++ b/src/index.c @@ -487,6 +487,11 @@ int git_index_find(git_index *index, const char *path) return git_vector_bsearch2(&index->entries, index_srch, path); } +void git_index_uniq(git_index *index) +{ + git_vector_uniq(&index->entries); +} + const git_index_entry_unmerged *git_index_get_unmerged_bypath(git_index *index, const char *path) { int pos; |
