Re: [PATCH] git-init: set up GIT_DIR/workdir if GIT_WORK_DIR is set
- From
- Matthias Lederhofer <matled@gmx.net>
- Date
- Mar 12, 2007, 20:40 UTC
- Message-ID
- <20070312204041.GA31018@moooo.ath.cx>
- In-Reply-To
- <7vird6qlbn.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 13 quoted lines
> Matthias Lederhofer <matled@gmx.net> writes: > > > I just thought that GIT_WORK_DIR should be relative to the current > > working directory because it's more intuitive, e.g. > > > > $ git --git-dir=/path/to/repo.git --work-dir=../.. add a > > > > where ../.. matches the path to the toplevel working directory from > > cwd. But this definitely is annoying when changing directories. > > Not so fast. That was a trick suggestion, only meant to see if > you have thought through the issues, and you did not have to > agree with me so quickly ;-).
Well, I have no strong feelings for either handling because I'll probably always use `pwd`/relative/path anyway.
Is there anything more to this decision than this?
GIT_WORK_DIR relative to cwd:
git --work-dir <path> [..] is more intuitiveGIT_WORK_DIR relative to $GIT_DIR:
$GIT_DIR/workdir and $GIT_WORK_DIR are interpreted exactly the
same way, which primarily makes it easier to implement git init
with --work-dir :-)> By the way, I do not find your command line example intuitive at > all, whether the --work-dir= parameter is relative or absolute. > Do you honestry expect that loooong command line is something > people would use in real life?
For one-shot things I prefer --git-dir and --work-dir over GIT_DIR and GIT_WORK_DIR because they are lowercase and for GIT_WORK_DIR it's even shorter; and all the examples were one-shot things (well, one used the same --git-dir twice).