From: Junio C Hamano Date: Wed, 25 May 2005 00:44:33 GMT Subject: [PATCH] Allow dot files in ls-files as well. Message-ID: <7v1x7wt9qm.fsf_-_@assigned-by-dhcp.cox.net> In-Reply-To: <7v8y24taai.fsf@assigned-by-dhcp.cox.net> >>>>> "JCH" == Junio C Hamano writes: >>>>> "LT" == Linus Torvalds writes: LT> I considered it, but it's so much easier to allow things LT> later than deny them, that I preferred being anal about it. JCH> That is not the point. GIT_DIR set to "GIT" would happily suck JCH> index file in. You are not being anal enough. ... which makes me feel that, since you cannot be anal enough anyway, it would be more consistent not to be more restrictive than necessary (the user has every right to screw himself anyway). No matter what you end up doing, you would need something like this as well (I am not screening .git here but that should be easy for you to add). ------------ Allow dot files in ls-files as well. Signed-off-by: Junio C Hamano --- cd /opt/packrat/playpen/public/in-place/git/git.junio/ PATH=.:$PATH jit-diff 1: 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,9 @@ 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 || + (de->d_name[1] == '.' && de->d_name[2] == 0))) continue; if (excluded(de->d_name) != show_ignored) continue;