git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Antoine Pelisse <apelisse@gmail.com>
To: git@vger.kernel.org
Cc: Antoine Pelisse <apelisse@gmail.com>
Subject: [PATCH v2] wt-status: Show ignored files in untracked dirs
Date: Wed, 26 Dec 2012 14:31:14 +0100	[thread overview]
Message-ID: <1356528674-2730-1-git-send-email-apelisse@gmail.com> (raw)
In-Reply-To: <1356516985-31068-1-git-send-email-apelisse@gmail.com>

When looking for ignored files, we do not recurse into untracked
directory, and simply consider the directory ignored status.
As a consequence, we don't see ignored files in those directories.

Change that behavior by recursing into untracked directories, if not
ignored themselves, searching for ignored files.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
---
Actually, the previous patch breaks the case where the directory is ignored.
This one should fix both issues.
Let me know if you see any other use case that could be an issue.

 dir.c       | 7 +++++++
 wt-status.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dir.c b/dir.c
index 5a83aa7..2863799 100644
--- a/dir.c
+++ b/dir.c
@@ -1042,6 +1042,13 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
 			return path_ignored;
 	}

+	/*
+	 * Don't recurse into ignored directories when looking for
+	 * ignored files, but still show the directory as ignored.
+	 */
+	if (exclude && (dir->flags & DIR_SHOW_IGNORED) && dtype == DT_DIR)
+		return path_handled;
+
 	switch (dtype) {
 	default:
 		return path_ignored;
diff --git a/wt-status.c b/wt-status.c
index 2a9658b..7c41488 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -516,7 +516,7 @@ static void wt_status_collect_untracked(struct wt_status *s)

 	if (s->show_ignored_files) {
 		dir.nr = 0;
-		dir.flags = DIR_SHOW_IGNORED | DIR_SHOW_OTHER_DIRECTORIES;
+		dir.flags = DIR_SHOW_IGNORED;
 		fill_directory(&dir, s->pathspec);
 		for (i = 0; i < dir.nr; i++) {
 			struct dir_entry *ent = dir.entries[i];
--
1.8.1.rc3.12.g8864e38

  reply	other threads:[~2012-12-26 13:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-26  5:57 Bug in git status Michael Haggerty
2012-12-26 10:16 ` [PATCH] wt-status: Show ignored files in untracked dirs Antoine Pelisse
2012-12-26 13:31   ` Antoine Pelisse [this message]
2012-12-27  2:37     ` [PATCH v2] " Junio C Hamano
2012-12-27  3:48       ` Jeff King
2012-12-27  5:08         ` Junio C Hamano
2012-12-27 16:14           ` Antoine Pelisse
2012-12-27 16:19             ` Jeff King
2012-12-27 17:35               ` Antoine Pelisse
2012-12-28 14:05                 ` Antoine Pelisse
2012-12-29  7:22                   ` Jeff King
2012-12-30 14:39                     ` [PATCH 1/2] dir.c: Make git-status --ignored more consistent Antoine Pelisse
2012-12-30 14:54                       ` Antoine Pelisse
2012-12-30 15:01                         ` Adam Spiers
2012-12-30 21:36                         ` Junio C Hamano
2012-12-30 14:39                     ` [PATCH 2/2] git-status: Test --ignored behavior 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1356528674-2730-1-git-send-email-apelisse@gmail.com \
    --to=apelisse@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).