diff options
author | Russell Belfer <rb@github.com> | 2014-02-10 13:20:08 -0800 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-17 14:43:45 -0700 |
commit | 3b4c401a38ce912d5be8c9bf4ab1c4912a4f08bd (patch) | |
tree | 4961b64fd558e1e55e9d1d96b37ca575c42ce008 /src/index.h | |
parent | dac160489bbf8de90d2f1ae152df68ded2603598 (diff) | |
download | libgit2-3b4c401a38ce912d5be8c9bf4ab1c4912a4f08bd.tar.gz |
Decouple index iterator sort from index
This makes the index iterator honor the GIT_ITERATOR_IGNORE_CASE
and GIT_ITERATOR_DONT_IGNORE_CASE flags without modifying the
index data itself. To take advantage of this, I had to export a
number of the internal index entry comparison functions. I also
wrote some new tests to exercise the capability.
Diffstat (limited to 'src/index.h')
-rw-r--r-- | src/index.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/index.h b/src/index.h index c2a932218..cb4425885 100644 --- a/src/index.h +++ b/src/index.h @@ -53,8 +53,13 @@ struct git_index_conflict_iterator { extern void git_index_entry__init_from_stat( git_index_entry *entry, struct stat *st, bool trust_mode); -extern int git_index_entry__cmp(const void *a, const void *b); -extern int git_index_entry__cmp_icase(const void *a, const void *b); +/* Index entry comparison functions for array sorting */ +extern int git_index_entry_cmp(const void *a, const void *b); +extern int git_index_entry_icmp(const void *a, const void *b); + +/* Index entry search functions for search using a search spec */ +extern int git_index_entry_srch(const void *a, const void *b); +extern int git_index_entry_isrch(const void *a, const void *b); /* Search index for `path`, returning GIT_ENOTFOUND if it does not exist. * `at_pos` is set to the position where it is or would be inserted. @@ -83,7 +88,7 @@ extern void git_index__release_snapshot(git_index *index); /* Allow searching in a snapshot; entries must already be sorted! */ extern int git_index__find_in_entries( size_t *at_pos, - git_vector *entries, git_vector_cmp entry_cmp, + git_vector *entries, git_vector_cmp entry_srch, const char *path, size_t path_len, int stage); #endif |