Subject: Re: Problem: staging of an alternative repository

From: Jonathan Nieder <[email-masked]>
Date: Wed, 30 Apr 2014 14:35:45 -0700

Hi Pavel,

Pasha Bolokhov wrote:

>     It turns out Git treats the directory '.git' differently enough
> from everything else. That may be ok,

Yeah, it's intended.

[...]
>     if you supply a different repository base name, say, '.git_new',
> by either setting GIT_DIR or using the '--git-dir' option, Git 'add'
> will not make any exception for it and think of it as a new (weird)
> directory.

Yep, a git repository metadata directory named .git_new is not special
in any way and you can use "git add" to track it if you want (for
example to add a testcase).

[...]
>     Now I know, the '--git-dir' option may usually be meant to use
> when the repository is somewhere outside of the work tree, and such a
> problem would not arise. And even if it is inside, sure enough, you
> can add this '.git_new' to the ignores or excludes. But is this really
> what you expect?

I think it's more that it never came up.  Excluding the current
$GIT_DIR from what "git add" can add (on top of the current rule of
excluding all instances of ".git") seems like a sensible change,
assuming it can be done without hurting the code too much. ;-)

But as you note, you are not using $GIT_DIR the way it was intended to
be used.

Thanks and hope that helps,
Jonathan