Merge branch 'ap/status-ignored-in-ignored-directory'
authorJunio C Hamano <gitster@pobox.com>
Mon, 14 Jan 2013 16:15:40 +0000 (08:15 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 Jan 2013 16:15:43 +0000 (08:15 -0800)
Output from "git status --ignored" showed an unexpected interaction
with "--untracked".

* ap/status-ignored-in-ignored-directory:
  status: always report ignored tracked directories
  git-status: Test --ignored behavior
  dir.c: Make git-status --ignored more consistent

1  2 
dir.c
wt-status.c

diff --cc dir.c
index e883a91483981ad9e2da4841063c1c8bad6a25fd,f836590b40f7ea69c94523b973c664e7a0c48c85..9dde68a2f3a1a325d2c5b90fa4d20dbf7670652c
--- 1/dir.c
--- 2/dir.c
+++ b/dir.c
@@@ -1003,6 -857,45 +1027,45 @@@ static enum directory_treatment treat_d
        return show_directory;
  }
  
 -              if (!path_excluded(&check, path->buf, path->len, dtype))
+ /*
+  * Decide what to do when we find a file while traversing the
+  * filesystem. Mostly two cases:
+  *
+  *  1. We are looking for ignored files
+  *   (a) File is ignored, include it
+  *   (b) File is in ignored path, include it
+  *   (c) File is not ignored, exclude it
+  *
+  *  2. Other scenarios, include the file if not excluded
+  *
+  * Return 1 for exclude, 0 for include.
+  */
+ static int treat_file(struct dir_struct *dir, struct strbuf *path, int exclude, int *dtype)
+ {
+       struct path_exclude_check check;
+       int exclude_file = 0;
+       if (exclude)
+               exclude_file = !(dir->flags & DIR_SHOW_IGNORED);
+       else if (dir->flags & DIR_SHOW_IGNORED) {
+               /* Always exclude indexed files */
+               struct cache_entry *ce = index_name_exists(&the_index,
+                   path->buf, path->len, ignore_case);
+               if (ce)
+                       return 1;
+               path_exclude_check_init(&check, dir);
++              if (!is_path_excluded(&check, path->buf, path->len, dtype))
+                       exclude_file = 1;
+               path_exclude_check_clear(&check);
+       }
+       return exclude_file;
+ }
  /*
   * This is an inexact early pruning of any recursive directory
   * reading - if the path cannot possibly be in the pathspec,
diff --cc wt-status.c
Simple merge