From: Junio C Hamano Date: Thu, 06 Dec 2007 16:04:29 GMT Subject: Re: builtin command's prefix question Message-ID: <7v63zbg67m.fsf@gitster.siamese.dyndns.org> In-Reply-To: Johannes Schindelin writes: > On Thu, 6 Dec 2007, Nguyen Thai Ngoc Duy wrote: > >> On Dec 6, 2007 6:22 AM, Junio C Hamano wrote: >> > However, if we define setup() to behave this way when GIT_DIR is not >> > defined and GIT_WORK_TREE is: >> > >> > (1) internally pretend as if GIT_DIR was specified to be the >> > directory where the command was started from (iow, do getcwd() >> > once upon startup); >> > >> > (2) chdir to GIT_WORK_TREE (which means "callers of setup() always >> > run from the top of the work tree"); >> > >> > (3) set prefix to NULL; >> >> (1) is fine by me, even if it goes up to find a gitdir. But (3), no, >> prefix should be set as relative path from worktree top directory to >> user current directory, not NULL. > > If you expect "git " to work correctly from GIT_DIR, > you will _have_ to set the prefix to NULL. That depends on the definition of "correctly". As I said, I think the above "rule-looking things" implement an insane behaviour where you are in one directory, and use that to name things relative to some other directory whose location is completely unrelated to the directory you are in. IOW, not a good set of rules, and I do not necessarily agree with the statement that says such a behaviour is working "correctly from GIT_DIR".