On Sun, Oct 19, 2008 at 03:47:04PM +0200, Maciej Pasternacki wrote: > As for -C being superfluous: --git-dir and --work-tree seem to support > weird usage patterns (like work tree separate from git-dir), but it seems Hmm. Yeah, thinking about it more, -C is not really superfluous with respect to those options. You don't want to say "here is the work-tree, and here is the git-dir". You want to say "find the work-tree and git-dir for me using the usual rules, as if I were in this directory." So you couldn't just say: git --work-tree=/chdir/path since that would assume your current directory was the git-dir. You would need: git --work-tree=/chdir/path --git-dir=/chdir/path/.git but then you are overriding any usual lookup rules (e.g., somebody having set GIT_DIR in the environment). Though I am not clear from your original description if that is even what you want. It sounds like you might be doing: git -C /chdir/path --git-dir=/back/to/where/I/was in which case I think work-tree _is_ a better fit. > to me that --work-tree could be just made a synonym of -C, and it would > behave as expected without creating chicken-and-egg problem that doener on > #git found (which I don't really understand, but I also can't see what > --work-tree allows that -C would not -- except creating more fragility). --work-tree allows you say "I'm _already_ in the git-dir, but please use this other place for the work-tree". So you can, for example, checkout files from a bare repository. >> Also, the envchanged flag should probably be set, as for the git-dir >> and work-tree options. > > OK. I thought it means literally environment change, as in setenv(). It is really used to tell the options parser for aliases that some options which change the operating environment should not be used in an alias. I.e., something like: git config alias.foo "--git-dir=/path/to/whatever log" isn't allowed, because we have already done some work on setting up the git-dir at this point. IMHO, this is a limitation of the current approach to setting up the environment, but fixing it would be nontrivial. I'm not 100% sure that doing a chdir should be disallowed in this instance, but I suspect it would cause problems. I think it is better in this instance to be conservative and disallow it in aliases. -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