Thread (1 message) 1 message, 1 author, 2016-06-15
DORMANTno replies

[PATCH] Allow dot files in ls-files as well (take #2).

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:41:58
Subsystem: the rest · Maintainer: Linus Torvalds

This attempts to match "the directory '.git' anywhere in the
tree is ignored" approach taken in update-cache.

Signed-off-by: Junio C Hamano <redacted>
---
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;


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help