Code

[PATCH] Allow dot files in ls-files as well (take #2).
authorJunio C Hamano <junkio@cox.net>
Wed, 25 May 2005 01:20:08 +0000 (18:20 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 25 May 2005 03:09:46 +0000 (20:09 -0700)
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>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
ls-files.c

index 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8..03b218260e99b78c6df0ed378e59ed9205ccc96d 100644 (file)
@@ -136,7 +136,10 @@ static void read_directory(const char *path, const char *base, int baselen)
                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;