diff options
author | Russell Belfer <rb@github.com> | 2014-04-24 22:59:50 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-24 22:59:50 +0400 |
commit | a409acefbbadeb607e4d6dde681bff5aed6ae9fc (patch) | |
tree | 9a1a24f42b89d776ad167625159c572cc7e6d5fc | |
parent | 219c89d19d7e18a336faa094b0c29cb7bb0d22c6 (diff) |
Handle explicitly ignored dir slightly differently
When considering status of untracked directories, if we find an
explicitly ignored item, even if it is a directory, treat the
parent as an IGNORED item. It was accidentally being treated as
an EMPTY item because we were not looking into the ignored subdir.
-rw-r--r-- | src/iterator.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/iterator.c b/src/iterator.c index dfa79977d..ef27fa71f 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -1566,25 +1566,26 @@ int git_iterator_advance_over_with_status( &wi->ignores, wi->fi.entry.path, &wi->is_ignored) < 0) wi->is_ignored = true; - if (!wi->is_ignored && S_ISDIR(entry->mode)) { + /* if we found an explicitly ignored item, then update from + * EMPTY to IGNORED + */ + if (wi->is_ignored) + *status = GIT_ITERATOR_STATUS_IGNORED; + else if (S_ISDIR(entry->mode)) { error = git_iterator_advance_into(&entry, iter); if (!error) continue; else if (error == GIT_ENOTFOUND) { error = 0; - wi->is_ignored = true; /* treat empty directories as ignored */ + wi->is_ignored = true; /* mark empty directories as ignored */ } else break; /* real error, stop here */ - } - - /* if we found a non-ignored item, treat parent as untracked */ - if (!wi->is_ignored) { + } else { + /* we found a non-ignored item, treat parent as untracked */ *status = GIT_ITERATOR_STATUS_NORMAL; break; } - if (entry && !S_ISDIR(entry->mode)) - *status = GIT_ITERATOR_STATUS_IGNORED; if ((error = git_iterator_advance(&entry, iter)) < 0) break; |