Merge branch 'kb/status-ignored-optim-2'
authorJunio C Hamano <gitster@pobox.com>
Mon, 3 Jun 2013 19:58:56 +0000 (12:58 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Jun 2013 19:58:56 +0000 (12:58 -0700)
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

1  2 
dir.c
t/t3001-ls-files-others-exclude.sh
diff --combined dir.c
index ee4d04dc8b378dab223ea8a8589dca7a58eeea48,13858fefa56b2d72f8ce6ce35f6bb8646f11ca81..897c87403e978ab2123ce088cf2d3265e21d7dde
--- 1/dir.c
--- 2/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);
  }
  
index 4e3735f0cb28d2b545f59a2464ea74bea4b626a1,b3814cdb42f380f234f3fb423cabc5c634f1c854..f0421c09c700bc1203d2ef563c54157e94c83b33
@@@ -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 &&
        (