diff options
author | Vicent Marti <tanoku@gmail.com> | 2015-12-16 12:30:52 +0100 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2015-12-16 12:30:52 +0100 |
commit | 879ebab314fe60cc737d436f62f190260ce13c1a (patch) | |
tree | 41d1fd8db670d5649959009eb6052da53595b932 /src/index.h | |
parent | 7f2c1469f8565fa8809c03aa7aa0ffae90a99c66 (diff) | |
download | libgit2-vmg/index-fill.tar.gz |
merge: Use `git_index__fill` to populate the indexvmg/index-fill
Instead of calling `git_index_add` in a loop, use the new
`git_index_fill` internal API to fill the index with the initial staged
entries.
The new `fill` helper assumes that all the entries will be unique and
valid, so it can append them at the end of the entries vector and only
sort it once at the end. It performs no validation checks.
This prevents the quadratic behavior caused by having to sort the
entries list once after every insertion.
Diffstat (limited to 'src/index.h')
-rw-r--r-- | src/index.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/index.h b/src/index.h index 9baf976ee..0909da889 100644 --- a/src/index.h +++ b/src/index.h @@ -113,6 +113,8 @@ GIT_INLINE(bool) git_index_entry_newer_than_index( extern int git_index__find_pos( size_t *at_pos, git_index *index, const char *path, size_t path_len, int stage); +extern int git_index__fill(git_index *index, const git_vector *source_entries); + extern void git_index__set_ignore_case(git_index *index, bool ignore_case); extern unsigned int git_index__create_mode(unsigned int mode); |