Re: GIT_DIR not auto ignored

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On zo, 2013-12-01 at 19:08 +0100, Dennis Kaarsemaker wrote:
> On za, 2013-11-30 at 23:06 -0800, Ingy dot Net wrote:
> > Greetings,
> > 
> > I found this probable bug:
> > https://gist.github.com/anonymous/01979fd9e6e285df41a2
> 
> Summary:
> 
> $ mv .git .foo
> $ export GIT_DIR=$PWD/.foo
> $ git status
> # On branch master
> #
> # Initial commit
> #
> # Untracked files:
> # .foo/
> nothing added to commit but untracked files present
> 
> 
> I checked with 1.8.5 and this still happens. 

This makes it go away:

diff --git a/dir.c b/dir.c
index 23b6de4..884b37d 100644
--- a/dir.c
+++ b/dir.c
@@ -1198,7 +1198,7 @@ static enum path_treatment treat_path(struct dir_struct *dir,
                return path_none;
        strbuf_setlen(path, baselen);
        strbuf_addstr(path, de->d_name);
-       if (simplify_away(path->buf, path->len, simplify))
+       if (simplify_away(path->buf, path->len, simplify) || is_git_directory(path->buf))
                return path_none;
 
        dtype = DTYPE(de);

I'll add a test and submit a proper patch.

> And this also happens:
> 
> $ mv .git .foo 
> $ export GIT_DIR=.foo
> dennis@lightning:~/code/git$ touch .git
> dennis@lightning:~/code/git$ git status
> On branch master
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> 
> 	.foo/
> 
> nothing added to commit but untracked files present (use "git add" to
> track)
> 
> (Note the absence of .git there)

Comments in dir.c indicate that this is expected, so I didn't try to
"fix" that.

-- 
Dennis Kaarsemaker
www.kaarsemaker.net

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]