On Thu, May 1, 2014 at 4:35 AM, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote: >> 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. ;-) I think it came up before. Changes could be very messy (but I did not check carefully) because right now we just compare $(basename $path) with ".git", one path component, simple and easy. Checking against $GIT_DIR means all path components. You also have to deal with relative and absolute paths and symlinks in some path components. You may also need to think if submodule detection code (checking ".git" again) is impacted. On top of that, read_directory() code is already messy (or at least scary to me) with all kinds of shortcuts we have added over the years. A simpler solution may be ignoring all directories whose last component is "$GIT_DIR_NAME" (e.g. GIT_DIR_NAME=.git_new). -- Duy -- 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