Re: [PATCH] -C/--chdir command line option
- From
Maciej Pasternacki <maciej@pasternacki.net>
- Date
- Oct 19, 2008, 15:24 UTC
- Message-ID
- <81E9D278-4851-4B1E-BE7D-D8563CEDA6F9@pasternacki.net>
- In-Reply-To
- <20081019141634.GA8997@coredump.intra.peff.net>
On 2008-10-19, at 16:16, Jeff King wrote:
Show 6 quoted lines
> 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.
No. I have a regular "git clone"'d work tree inside some "shelf" directory containing many repos (not only from git), and I'd like to pull changes into this work tree. As simple as "cvs up". But -- I don't want to chdir() there myself, and I had no problem with cvs, svn and darcs (didn't do other VC systems yet). So, -C would do exactly what I need.
Show 22 quoted lines
>>> 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.
In this case, I think envchanged should not be set -- I would expect - C dir to work *exactly* like "cd dir && git ...", including configuration, environment variables and so on. OTOH, option like "-- no-env" may be useful in my case -- I want git to behave consistently on users' machines, regardless of their configuration. This, however, is only a minor issue.
Regards, Maciej.
-- -><- Maciej Pasternacki -><- http://www.pasternacki.net/ -><-