Re: [PATCH] -C/--chdir command line option
From: Maciej Pasternacki <hidden>
Date: 2016-06-15 22:45:30
On 2008-10-20, at 06:55, Junio C Hamano wrote:
quoted
quoted
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 seemsHmm. 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."I think that interpretation of -C, if the option existed, makes sense, but I do not understand why the tool that drives git refuses to chdir to the repository for itself in the first place.
The tool (a) manages many repositories, and I don't want to chdir() back and forth, (b) should be able to manage those repositories not disturbing anything other. It comes as a Common Lisp library, which will usually be called by end user, but can also be called programmatically, and I wouldn't want any library to change my cwd; it could chdir() back, of course, but this would still be a race condition if other threads were running at the same time. And there is the Lisp-specific thing, that the language comes from before Unix domination, and things as simple as changing the process' cwd are actually nontrivial to do portably (there is equivalent of cwd inside Lisp world, which is used by Lisp-level file access routines, but chdir() is not in ANSI standard, is done differently by every implementation, and would require some kind of compatibility layer). For me, -C would make life much easier, and I gave other arguments for it before. It would suffice if --work-tree worked with "git pull", if -C doesn't pass, but it seems to me that -C has some merits. Regards, Maciej. -- -><- Maciej Pasternacki -><- http://www.pasternacki.net/ -><-