From: Junio C Hamano Date: Mon, 3 Jun 2013 19:58:56 +0000 (-0700) Subject: Merge branch 'kb/status-ignored-optim-2' X-Git-Tag: v1.8.4-rc0~222 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3684101a654d5a7b598d9810df3b498f2a8928d0?ds=inline;hp=-c 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 --- 3684101a654d5a7b598d9810df3b498f2a8928d0 diff --combined dir.c index ee4d04dc8b,13858fefa5..897c87403e --- a/dir.c +++ b/dir.c @@@ -821,6 -821,9 +821,9 @@@ static void prep_exclude(struct dir_str 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; @@@ -1542,9 -1545,9 +1545,9 @@@ void setup_standard_excludes(struct dir home_config_paths(NULL, &xdg_path, "ignore"); excludes_file = xdg_path; } - if (!access_or_warn(path, R_OK)) + if (!access_or_warn(path, R_OK, 0)) add_excludes_from_file(dir, path); - if (excludes_file && !access_or_warn(excludes_file, R_OK)) + if (excludes_file && !access_or_warn(excludes_file, R_OK, 0)) add_excludes_from_file(dir, excludes_file); } diff --combined t/t3001-ls-files-others-exclude.sh index 4e3735f0cb,b3814cdb42..f0421c09c7 --- a/t/t3001-ls-files-others-exclude.sh +++ b/t/t3001-ls-files-others-exclude.sh @@@ -103,7 -103,7 +103,7 @@@ test_expect_success test_cmp expect output' test_expect_success 'restore gitignore' ' - git checkout $allignores && + git checkout --ignore-skip-worktree-bits $allignores && rm .git/index ' @@@ -175,6 -175,24 +175,24 @@@ test_expect_success 'negated exclude ma 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 && (