summaryrefslogtreecommitdiff
path: root/src/vector.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-02-10 13:20:08 -0800
committerRussell Belfer <rb@github.com>2014-04-17 14:43:45 -0700
commit3b4c401a38ce912d5be8c9bf4ab1c4912a4f08bd (patch)
tree4961b64fd558e1e55e9d1d96b37ca575c42ce008 /src/vector.c
parentdac160489bbf8de90d2f1ae152df68ded2603598 (diff)
downloadlibgit2-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/vector.c')
-rw-r--r--src/vector.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vector.c b/src/vector.c
index 9f7eed5a3..c769b696a 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -177,7 +177,8 @@ void git_vector_sort(git_vector *v)
if (git_vector_is_sorted(v) || !v->_cmp)
return;
- git__tsort(v->contents, v->length, v->_cmp);
+ if (v->length > 1)
+ git__tsort(v->contents, v->length, v->_cmp);
git_vector_set_sorted(v, 1);
}