summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorMichael Spang <mspang@uwaterloo.ca>2007-05-06 22:35:04 -0400
committerJunio C Hamano <junkio@cox.net>2007-05-07 15:29:29 -0700
commitb991625611da1cba39c6ac50d0329e5d5ce5d0ab (patch)
treeacf35ab82313684801e68d7a03e933ecf3a34ffc /dir.c
parent070739fd351702ea9bb4f65595728ae25a488075 (diff)
downloadgit-b991625611da1cba39c6ac50d0329e5d5ce5d0ab.tar.gz
dir.c: Omit non-excluded directories with dir->show_ignored
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index d3063520b0..11fab7f4bf 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,