summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2019-12-10 20:00:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-11 20:23:23 (GMT)
commita2b13367fe55bdeb10862f41aff3e2446b63e171 (patch)
treebfc0ed8525829dda1e003718ed4679ca2b04756f /dir.c
parent452efd11fbf607ad12854edf1488112a7e4790d2 (diff)
downloadgit-a2b13367fe55bdeb10862f41aff3e2446b63e171.zip
git-a2b13367fe55bdeb10862f41aff3e2446b63e171.tar.gz
git-a2b13367fe55bdeb10862f41aff3e2446b63e171.tar.bz2
Revert "dir.c: make 'git-status --ignored' work within leading directories"
Commit be8a84c52669 ("dir.c: make 'git-status --ignored' work within leading directories", 2013-04-15) noted that git status --ignored <SOMEPATH> would not list ignored files and directories within <SOMEPATH> if <SOMEPATH> was untracked, and modified the behavior to make it show them. However, it did so via a hack that broke consistency; it would show paths under <SOMEPATH> differently than a simple git status --ignored | grep <SOMEPATH> would show them. A correct fix is slightly more involved, and complicated slightly by this hack, so we revert this commit (but keep corrected versions of the testcases) and will later fix the original bug with a subsequent patch. Some history may be helpful: A very, very similar case to the commit we are reverting was raised in commit 48ffef966c76 ("ls-files: fix overeager pathspec optimization", 2010-01-08); but it actually went in somewhat the opposite direction. In that commit, it mentioned how git ls-files -o --exclude-standard t/ used to show untracked files under t/ even when t/ was ignored, and then changed the behavior to stop showing untracked files under an ignored directory. More importantly, this commit considered keeping this behavior but noted that it would be inconsistent with the behavior when multiple pathspecs were specified and thus rejected it. The reason for this whole inconsistency when one pathspec is specified versus zero or two is because common prefixes of pathspecs are sent through a different set of checks (in treat_leading_path()) than normal file/directory traversal (those go through read_directory_recursive() and treat_path()). As such, for consistency, one needs to check that both codepaths produce the same result. Revert commit be8a84c526691667fc04a8241d93a3de1de298ab, except instead of removing the testcase it added, modify it to check for correct and consistent behavior. A subsequent patch in this series will fix the testcase. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/dir.c b/dir.c
index 61f559f9..0dd5266 100644
--- a/dir.c
+++ b/dir.c
@@ -2083,14 +2083,12 @@ static int treat_leading_path(struct dir_struct *dir,
struct strbuf sb = STRBUF_INIT;
int baselen, rc = 0;
const char *cp;
- int old_flags = dir->flags;
while (len && path[len - 1] == '/')
len--;
if (!len)
return 1;
baselen = 0;
- dir->flags &= ~DIR_SHOW_OTHER_DIRECTORIES;
while (1) {
cp = path + baselen + !!baselen;
cp = memchr(cp, '/', path + len - cp);
@@ -2113,7 +2111,6 @@ static int treat_leading_path(struct dir_struct *dir,
}
}
strbuf_release(&sb);
- dir->flags = old_flags;
return rc;
}