public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Michael Spang <mspang@uwaterloo•ca>
To: Git Mailing List <git@vger•kernel.org>
Cc: Junio C Hamano <junkio@cox•net>,
	Linus Torvalds <torvalds@linux-foundation•org>
Subject: Re: [PATCH 2/3] dir.c: Omit non-excluded directories with dir->show_ignored
Date: Sun, 06 May 2007 22:35:04 -0400	[thread overview]
Message-ID: <463E9058.5080907@uwaterloo.ca> (raw)
In-Reply-To: <alpine.LFD.0.98.0705061239460.25245@woody.linux-foundation.org>

This makes "git-ls-files --others --directory --ignored" behave
as documented and consequently also fixes "git-clean -d -X".
Previously, git-clean would remove non-excluded directories
even when using the -X option.

Signed-off-by: Michael Spang <mspang@uwaterloo•ca>
---

This fixes the style issue noted by Linus.


 dir.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dir.c b/dir.c
index d306352..11fab7f 100644
--- a/dir.c
+++ b/dir.c
@@ -448,6 +448,7 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
 
 		while ((de = readdir(fdir)) != NULL) {
 			int len;
+			int exclude;
 
 			if ((de->d_name[0] == '.') &&
 			    (de->d_name[1] == 0 ||
@@ -461,7 +462,9 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
 			memcpy(fullname + baselen, de->d_name, len+1);
 			if (simplify_away(fullname, baselen + len, simplify))
 				continue;
-			if (excluded(dir, fullname) != dir->show_ignored) {
+
+			exclude = excluded(dir, fullname);
+			if (exclude != dir->show_ignored) {
 				if (!dir->show_ignored || DTYPE(de) != DT_DIR) {
 					continue;
 				}
@@ -484,6 +487,8 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
 				len++;
 				switch (treat_directory(dir, fullname, baselen + len, simplify)) {
 				case show_directory:
+					if (exclude != dir->show_ignored)
+						continue;
 					break;
 				case recurse_into_directory:
 					contents += read_directory_recursive(dir,

  parent reply	other threads:[~2007-05-07  2:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <463E1705.2090201@gmail.com>
2007-05-06 18:09 ` [PATCH 2/3] dir.c: Omit non-excluded directories with dir->show_ignored Michael Spang
2007-05-06 19:42   ` Linus Torvalds
2007-05-06 20:18     ` Michael Spang
2007-05-07  2:35     ` Michael Spang [this message]
2007-05-06 18:09 ` [PATCH 3/3] Fix minor documentation errors Michael Spang
2007-05-06 18:09 ` [PATCH/RFD 4/3] t7300: Tests for git-clean using filenames with spaces/punctuation Michael Spang
2007-05-06 18:54   ` Junio C Hamano
2007-05-06 19:14     ` Michael Spang

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=463E9058.5080907@uwaterloo.ca \
    --to=mspang@uwaterloo$(echo .)ca \
    --cc=git@vger$(echo .)kernel.org \
    --cc=junkio@cox$(echo .)net \
    --cc=torvalds@linux-foundation$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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