Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Andreas Schwab
Jeff King writes: > Bash is even weirder than you might think. Try this: > > $ echo ~/foo > /home/peff/foo > > $ echo arg=~/foo > arg=/home/peff/foo > > $ echo --arg=~/foo > --arg=~/foo Bash expands all arguments that look like variable assignments. That lets you write "export arg=~

Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Michael J Gruber
Jeff King venit, vidit, dixit 24.09.2012 16:49: > On Mon, Sep 24, 2012 at 09:19:27AM +0200, Michael J Gruber wrote: > >> [mjg@localhost ~]$ GIT_DIR=~/.githome git rev-parse --show-toplevel >> /home/mjg >> >> [mjg@localhost ~]$ git --git-dir=~/.githome rev-parse --show-toplevel >> fatal: Not a git

Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Michael J Gruber
Junio C Hamano venit, vidit, dixit 24.09.2012 16:36: > Nguyen Thai Ngoc Duy writes: > >> "~" is a shell feature. Know your shell. If we make an exception for >> --git-dir, we might have to support --blahblah=~/somewhere. > > Correct but not entirely true. > > When we know --git-dir= must name a

Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Jeff King
On Mon, Sep 24, 2012 at 09:19:27AM +0200, Michael J Gruber wrote: > [mjg@localhost ~]$ GIT_DIR=~/.githome git rev-parse --show-toplevel > /home/mjg > > [mjg@localhost ~]$ git --git-dir=~/.githome rev-parse --show-toplevel > fatal: Not a git repository: '~/.githome' > > Huh? Ok, so most users pro

Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Junio C Hamano
Nguyen Thai Ngoc Duy writes: > "~" is a shell feature. Know your shell. If we make an exception for > --git-dir, we might have to support --blahblah=~/somewhere. Correct but not entirely true. When we know --git-dir= must name a path, we should be able to do better. See OPT_FILENAME in >parse-

Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Andreas Schwab
Michael J Gruber writes: > But that argument applies to config files in exactly the same way as it > applies to command line arguments. Git is the only one reading them. So > why not leave it up to Git to decide about expansion? Command line arguments are first processed by the shell, handling e

Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Michael J Gruber
Nguyen Thai Ngoc Duy venit, vidit, dixit 24.09.2012 11:53: > On Mon, Sep 24, 2012 at 2:57 PM, Michael J Gruber > wrote: >> It might be difficult to implement, but I'm sorry I can't follow the >> argumentation above at all; it's not based on what we do in other places >> and other cases. > > My po

Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Nguyen Thai Ngoc Duy
On Mon, Sep 24, 2012 at 2:57 PM, Michael J Gruber wrote: > It might be difficult to implement, but I'm sorry I can't follow the > argumentation above at all; it's not based on what we do in other places > and other cases. My point is, what's so special about --git-dir? what about --work-tree, or

Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Michael J Gruber
Nguyen Thai Ngoc Duy venit, vidit, dixit 24.09.2012 09:41: > On Mon, Sep 24, 2012 at 2:19 PM, Michael J Gruber > wrote: >> [mjg@localhost ~]$ GIT_DIR=~/.githome git rev-parse --show-toplevel >> /home/mjg >> >> [mjg@localhost ~]$ git --git-dir=~/.githome rev-parse --show-toplevel >> fatal: Not a gi

Re: GIT_DIR vs. --git-dir

2012-09-24 Thread Nguyen Thai Ngoc Duy
On Mon, Sep 24, 2012 at 2:19 PM, Michael J Gruber wrote: > [mjg@localhost ~]$ GIT_DIR=~/.githome git rev-parse --show-toplevel > /home/mjg > > [mjg@localhost ~]$ git --git-dir=~/.githome rev-parse --show-toplevel > fatal: Not a git repository: '~/.githome' > > Huh? The message looks pretty clear

GIT_DIR vs. --git-dir

2012-09-24 Thread Michael J Gruber
[mjg@localhost ~]$ GIT_DIR=~/.githome git rev-parse --show-toplevel /home/mjg [mjg@localhost ~]$ git --git-dir=~/.githome rev-parse --show-toplevel fatal: Not a git repository: '~/.githome' Huh? Ok, so most users probably would not try further and blame git, but: [mjg@localhost ~]$ git --git-dir