summaryrefslogtreecommitdiff
path: root/src/status.c
diff options
context:
space:
mode:
authorPhilip Kelley <phkelley@hotmail.com>2012-09-17 15:42:41 -0400
committerPhilip Kelley <phkelley@hotmail.com>2012-09-17 15:42:41 -0400
commitec40b7f99f7f7161b0a1b24f1d8a934ec0eaacb1 (patch)
tree59744c10038258c3993a4eb1b1dfc3896c35b97a /src/status.c
parente8776d30f7edb570f435cf746d712c696b862bdd (diff)
downloadlibgit2-ec40b7f99f7f7161b0a1b24f1d8a934ec0eaacb1.tar.gz
Support for core.ignorecase
Diffstat (limited to 'src/status.c')
-rw-r--r--src/status.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/status.c b/src/status.c
index 0a5fbdcbf..3a0ed075f 100644
--- a/src/status.c
+++ b/src/status.c
@@ -82,6 +82,7 @@ int git_status_foreach_ext(
opts ? opts->show : GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
git_diff_delta *i2h, *w2i;
size_t i, j, i_max, j_max;
+ bool ignore_case = false;
assert(show <= GIT_STATUS_SHOW_INDEX_THEN_WORKDIR);
@@ -124,11 +125,26 @@ int git_status_foreach_ext(
i_max = idx2head ? idx2head->deltas.length : 0;
j_max = wd2idx ? wd2idx->deltas.length : 0;
+ if (idx2head && wd2idx &&
+ (0 != (idx2head->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) ||
+ 0 != (wd2idx->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE)))
+ {
+ /* Then use the ignore-case sorter... */
+ ignore_case = true;
+
+ /* and assert that both are ignore-case sorted. If this function
+ * ever needs to support merge joining result sets that are not sorted
+ * by the same function, then it will need to be extended to do a spool
+ * and sort on one of the results before merge joining */
+ assert(0 != (idx2head->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) &&
+ 0 != (wd2idx->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE));
+ }
+
for (i = 0, j = 0; !err && (i < i_max || j < j_max); ) {
i2h = idx2head ? GIT_VECTOR_GET(&idx2head->deltas,i) : NULL;
w2i = wd2idx ? GIT_VECTOR_GET(&wd2idx->deltas,j) : NULL;
- cmp = !w2i ? -1 : !i2h ? 1 : strcmp(i2h->old_file.path, w2i->old_file.path);
+ cmp = !w2i ? -1 : !i2h ? 1 : STRCMP_CASESELECT(ignore_case, i2h->old_file.path, w2i->old_file.path);
if (cmp < 0) {
if (cb(i2h->old_file.path, index_delta2status(i2h->status), cbdata))