On Sun, Nov 01, 2009 at 04:19:34PM -0500, Daniel Barkalow wrote: > > > Do things like git_path() fail cleanly if there was no git directory? If > > > not, there should probably be tests of nongit on paths that actually need > > > a git directory,... > > > > I don't know. Again, you tell me ;-) > > I'm not an expert on that part. But it looks like it misbehaves, returning > ".git/foo" even when that path doesn't make sense. I will not admit to being an expert in that area, but yes, that is what I observed before while looking into some of our weird startup problems. We really have two systems for setting up the environment: - setup_git_directory, which tries to do everything at the outset (but which we don't necessarily run for all commands, and where "outset" is defined as when the git wrapper handles an actual command, which means we sometimes do quite a bit of stuff beforehand) - some lazy magic in environment.c, mostly setup_git_env. If setup_git_directory has been run, this does the right thing because it reads GIT_DIR from the environment as set previously. But if not, then it can quite often do the wrong thing (as you noticed). I tried simply ditching the lazy magic, but that doesn't work: there are many cases where setup_git_directory hasn't been run. Moving it to the very beginning doesn't quite work, either. I don't remember the details, sadly. It may be that the lazy setup_git_env magic should, rather than doing anything itself, call setup_git_directory if it has not been initialized. But at that point, you might as well setup_git_directory in every program, since just about every one is going to want to look at git_path at some point. Sorry, I know that is vague. Refactoring this area has been on my plate for so long that I have forgotten all the details, and it is such a messy area that I am continually procrastinating on diving back into it. ;) -Peff -- 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