summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-11-13 14:02:59 -0800
committerRussell Belfer <rb@github.com>2012-11-14 22:55:40 -0800
commitbad68c0a998116685ad75cab84210004dd2c5be1 (patch)
treed8b6db9be06ea1fcc150b5a7d2ba4cd635a174aa /src/index.c
parent5735bf5e6ab4da347b601d4b85c09c5c701dc002 (diff)
downloadlibgit2-bad68c0a998116685ad75cab84210004dd2c5be1.tar.gz
Add iterator for git_index object
The index iterator could previously only be created from a repo object, but this allows creating an iterator from a `git_index` object instead (while keeping, though renaming, the old function).
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c
index 007f19a43..128dd18cf 100644
--- a/src/index.c
+++ b/src/index.c
@@ -835,7 +835,9 @@ unsigned int git_index__prefix_position(git_index *index, const char *path)
srch_key.path = path;
srch_key.stage = 0;
- git_vector_bsearch3(&pos, &index->entries, index->entries_search, &srch_key);
+ git_vector_sort(&index->entries);
+ git_vector_bsearch3(
+ &pos, &index->entries, index->entries_search, &srch_key);
return pos;
}