summaryrefslogtreecommitdiff
path: root/pathspec.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-07-14 15:35:45 +0700
committerJunio C Hamano <gitster@pobox.com>2013-07-15 10:56:07 -0700
commit931eab64ad24a742182c4e946a1138e677a8bd4e (patch)
treed4da3305885d22ae810291cd54bab589fe6f5f23 /pathspec.c
parentf3e743a0d972e8ed3367d74c1152ff66f7cde416 (diff)
downloadgit-931eab64ad24a742182c4e946a1138e677a8bd4e.tar.gz
check-ignore: convert to use parse_pathspec
check-ignore (at least the test suite) seems to rely on the pattern order. PATHSPEC_KEEP_ORDER is introduced to explictly express this. The lack of PATHSPEC_MAXDEPTH_VALID is sufficient because it's the only flag that reorders pathspecs, but it's less obvious that way. Cc: Adam Spiers <git@adamspiers.org> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pathspec.c')
-rw-r--r--pathspec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pathspec.c b/pathspec.c
index ba6408a74c..5c9631a1a1 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -370,9 +370,13 @@ void parse_pathspec(struct pathspec *pathspec,
pathspec->magic |= item[i].magic;
}
- if (pathspec->magic & PATHSPEC_MAXDEPTH)
+
+ if (pathspec->magic & PATHSPEC_MAXDEPTH) {
+ if (flags & PATHSPEC_KEEP_ORDER)
+ die("BUG: PATHSPEC_MAXDEPTH_VALID and PATHSPEC_KEEP_ORDER are incompatible");
qsort(pathspec->items, pathspec->nr,
sizeof(struct pathspec_item), pathspec_item_cmp);
+ }
}
/*