summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dir.c2
-rwxr-xr-xt/t3001-ls-files-others-exclude.sh6
2 files changed, 7 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index d9b5561466..22d0b7b726 100644
--- a/dir.c
+++ b/dir.c
@@ -585,7 +585,7 @@ int excluded_from_list(const char *pathname,
namelen -= prefix;
}
- if (!namelen || !fnmatch_icase(exclude, name, FNM_PATHNAME))
+ if (!fnmatch_icase(exclude, name, FNM_PATHNAME))
return to_exclude;
}
return -1; /* undecided */
diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh
index c8fe978267..dc2f0458fd 100755
--- a/t/t3001-ls-files-others-exclude.sh
+++ b/t/t3001-ls-files-others-exclude.sh
@@ -214,4 +214,10 @@ test_expect_success 'subdirectory ignore (l1)' '
test_cmp expect actual
'
+test_expect_success 'pattern matches prefix completely' '
+ : >expect &&
+ git ls-files -i -o --exclude "/three/a.3[abc]" >actual &&
+ test_cmp expect actual
+'
+
test_done