[PATCH] Allow dot files in ls-files as well (take #2).
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 25, 2005, 01:20 UTC
- Message-ID
- <7vwtpoqeyf.fsf_-_@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.58.0505241753300.2307@ppc970.osdl.org>
This attempts to match "the directory '.git' anywhere in the tree is ignored" approach taken in update-cache.
Signed-off-by: Junio C Hamano <junkio@cox.net> --- cd /opt/packrat/playpen/public/in-place/git/git.junio/ PATH=.:$PATH jit-diff : ls-files.c # - linus: git-update-cache: allow dot-files # + (working tree)
diff --git a/ls-files.c b/ls-files.c --- a/ls-files.c +++ b/ls-files.c @@ -136,7 +136,10 @@ static void read_directory(const char *p while ((de = readdir(dir)) != NULL) { int len; - if (de->d_name[0] == '.') + if ((de->d_name[0] == '.') && + (de->d_name[1] == 0 || + !strcmp(de->d_name + 1, ".") || + !strcmp(de->d_name + 1, "git"))) continue; if (excluded(de->d_name) != show_ignored) continue;