Skip to content

Commit

Permalink
status: always report ignored tracked directories
Browse files Browse the repository at this point in the history
When enumerating paths that are ignored, paths the index knows
about are not included in the result.  The "index knows about"
check is done by consulting the name hash, not the actual
contents of the index:

 - When core.ignorecase is false, directory names are not in the
   name hash, and ignored ones are shown as ignored (directories
   can never be tracked anyway).

 - When core.ignorecase is true, however, the name hash keeps
   track of the names of directories, in order to detect
   additions of the paths under different cases.  This causes
   ignored directories to be mistakenly excluded when
   enumerating ignored paths.

Stop excluding directories that are in the name hash when
looking for ignored files in dir_add_name(); the names that are
actually in the index are excluded much earlier in the callchain
in treat_file(), so this fix will not make them mistakenly
identified as ignored.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Antoine Pelisse authored and Junio C Hamano committed Jan 7, 2013
1 parent eb8c5b8 commit a45fb69
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ static struct dir_entry *dir_entry_new(const char *pathname, int len)

static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len)
{
if (cache_name_exists(pathname, len, ignore_case))
if (!(dir->flags & DIR_SHOW_IGNORED) &&
cache_name_exists(pathname, len, ignore_case))
return NULL;

ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
Expand Down Expand Up @@ -877,11 +878,7 @@ static int treat_file(struct dir_struct *dir, struct strbuf *path, int exclude,
if (exclude)
exclude_file = !(dir->flags & DIR_SHOW_IGNORED);
else if (dir->flags & DIR_SHOW_IGNORED) {
/*
* Optimization:
* Don't spend time on indexed files, they won't be
* added to the list anyway
*/
/* Always exclude indexed files */
struct cache_entry *ce = index_name_exists(&the_index,
path->buf, path->len, ignore_case);

Expand Down

0 comments on commit a45fb69

Please sign in to comment.