diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-06-03 12:58:56 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-03 12:58:56 -0700 |
commit | 3684101a654d5a7b598d9810df3b498f2a8928d0 (patch) | |
tree | d0b60e2ef0bc9279f77543cefe14688593b06f42 | |
parent | test: fix post rewrite hook report (diff) | |
parent | dir.c: fix ignore processing within not-ignored directories (diff) | |
download | tgif-3684101a654d5a7b598d9810df3b498f2a8928d0.tar.xz |
Merge branch 'kb/status-ignored-optim-2'
Fix 1.8.3 regressions in the .gitignore path exclusion logic.
* kb/status-ignored-optim-2:
dir.c: fix ignore processing within not-ignored directories
-rw-r--r-- | dir.c | 3 | ||||
-rwxr-xr-x | t/t3001-ls-files-others-exclude.sh | 18 |
2 files changed, 21 insertions, 0 deletions
@@ -821,6 +821,9 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen) dir->basebuf, stk->baselen - 1, dir->basebuf + current, &dt); dir->basebuf[stk->baselen - 1] = '/'; + if (dir->exclude && + dir->exclude->flags & EXC_FLAG_NEGATIVE) + dir->exclude = NULL; if (dir->exclude) { dir->basebuf[stk->baselen] = 0; dir->exclude_stack = stk; diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh index 4e3735f0cb..f0421c09c7 100755 --- a/t/t3001-ls-files-others-exclude.sh +++ b/t/t3001-ls-files-others-exclude.sh @@ -175,6 +175,24 @@ test_expect_success 'negated exclude matches can override previous ones' ' grep "^a.1" output ' +test_expect_success 'excluded directory overrides content patterns' ' + + git ls-files --others --exclude="one" --exclude="!one/a.1" >output && + if grep "^one/a.1" output + then + false + fi +' + +test_expect_success 'negated directory doesn'\''t affect content patterns' ' + + git ls-files --others --exclude="!one" --exclude="one/a.1" >output && + if grep "^one/a.1" output + then + false + fi +' + test_expect_success 'subdirectory ignore (setup)' ' mkdir -p top/l1/l2 && ( |