From: Antoine Pelisse <apelisse@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Antoine Pelisse <apelisse@gmail.com>, tboegi@web.de, git@vger.kernel.org
Subject: [PATCH v2] status: always report ignored tracked directories
Date: Sun, 6 Jan 2013 23:09:39 +0100 [thread overview]
Message-ID: <1357510179-22852-1-git-send-email-apelisse@gmail.com> (raw)
In-Reply-To: <20130105230303.GA5195@sigill.intra.peff.net>
Tracked directories (i.e. directories containing tracked files) that
are ignored must be reported as ignored if they contain untracked files.
Currently, files in the index can't be reported as ignored and are
automatically dropped from the list:
- When core.ignorecase is false, directories (which are not directly
tracked) are not listed as part of the index, and the directory can be
shown as ignored.
- When core.ignorecase is true on the other hand, directories are
reported as part of the index, and the directory is dropped, thus not
displayed as ignored.
Fix that behavior by allowing indexed file to be added when looking for
ignored files.
- Ignored tracked and untracked directories are treated the same way
when looking for ignored files, so we should not care about their index
status.
- Files are dismissed by treat_file() if they belong to the
index, so that step would have been a no-op anyway.
Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
---
dir.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/dir.c b/dir.c
index 9b80348..f836590 100644
--- a/dir.c
+++ b/dir.c
@@ -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);
@@ -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);
--
1.7.12.4.3.g90f5e2d
next prev parent reply other threads:[~2013-01-06 22:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-05 11:07 t7061: comments and one failure Torsten Bögershausen
2013-01-05 11:24 ` Jeff King
2013-01-05 11:29 ` Antoine Pelisse
2013-01-05 20:42 ` [PATCH] status: report ignored yet tracked directories Antoine Pelisse
2013-01-05 21:27 ` Torsten Bögershausen
2013-01-05 23:03 ` Jeff King
2013-01-06 16:40 ` Antoine Pelisse
2013-01-07 8:33 ` Jeff King
2013-01-06 22:09 ` Antoine Pelisse [this message]
2013-01-07 17:21 ` [PATCH v2] status: always report ignored " Torsten Bögershausen
2013-01-07 17:50 ` Junio C Hamano
2013-01-07 19:06 ` Junio C Hamano
2013-01-07 20:24 ` Antoine Pelisse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357510179-22852-1-git-send-email-apelisse@gmail.com \
--to=apelisse@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=tboegi@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).