mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 17:46:09 +00:00
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>
This commit is contained in:
parent
476c42acc5
commit
245adf4f3c
@ -172,6 +172,13 @@ GIT_EXTERN(int) git_index_write(git_index *index);
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_find(git_index *index, const char *path);
|
||||
|
||||
/**
|
||||
* Remove all entries with equal path except last added
|
||||
*
|
||||
* @param index an existing index object
|
||||
*/
|
||||
GIT_EXTERN(void) git_index_uniq(git_index *index);
|
||||
|
||||
/**
|
||||
* Add or update an index entry from a file in disk
|
||||
*
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user