summaryrefslogtreecommitdiff
path: root/builtin/check-ignore.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2018-02-10 12:38:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-12 21:09:35 (GMT)
commitd60771e93046e9e11183c6ff1fcafd334f8c0453 (patch)
treeb104f07d171ab35990d422e29534e2a5e6d67bb3 /builtin/check-ignore.c
parentfc849d8d6b90e5c1e0c37bc0d60dd92b2fe7347f (diff)
downloadgit-d60771e93046e9e11183c6ff1fcafd334f8c0453.zip
git-d60771e93046e9e11183c6ff1fcafd334f8c0453.tar.gz
git-d60771e93046e9e11183c6ff1fcafd334f8c0453.tar.bz2
check-ignore: fix mix of directories and other file types
In check_ignore(), the first pathspec item determines the dtype for any subsequent ones. That means that a pathspec matching a regular file can prevent following pathspecs from matching directories, which makes no sense. Fix that by determining the dtype for each pathspec separately, by passing the value DT_UNKNOWN to last_exclude_matching() each time. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/check-ignore.c')
-rw-r--r--builtin/check-ignore.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
index 3e280b9..ec9a959 100644
--- a/builtin/check-ignore.c
+++ b/builtin/check-ignore.c
@@ -72,7 +72,7 @@ static int check_ignore(struct dir_struct *dir,
{
const char *full_path;
char *seen;
- int num_ignored = 0, dtype = DT_UNKNOWN, i;
+ int num_ignored = 0, i;
struct exclude *exclude;
struct pathspec pathspec;
@@ -104,6 +104,7 @@ static int check_ignore(struct dir_struct *dir,
full_path = pathspec.items[i].match;
exclude = NULL;
if (!seen[i]) {
+ int dtype = DT_UNKNOWN;
exclude = last_exclude_matching(dir, &the_index,
full_path, &dtype);
}