Re: [PATCH/RFC] git.c: support "!!" aliases that do not move cwd
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 7, 2016, 14:19 UTC
- Message-ID
- <alpine.DEB.2.20.1610071616390.35196@virtualbox>
- In-Reply-To
- <e1b432bc-97b4-15be-aa44-71921c64cd15@gmail.com>
Hi Kuba,
On Fri, 7 Oct 2016, Jakub Narębski wrote:
Show 26 quoted lines
> W dniu 07.10.2016 o 13:20, Johannes Schindelin pisze: > > On Thu, 6 Oct 2016, Junio C Hamano wrote: > >> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes: > >> > >>> Throwing something at the mailing list to see if anybody is > >>> interested. > >>> > >>> Current '!' aliases move cwd to $GIT_WORK_TREE first, which could make > >>> handling path arguments hard because they are relative to the original > >>> cwd. We set GIT_PREFIX to work around it, but I still think it's more > >>> natural to keep cwd where it is. > >>> > >>> We have a way to do that now after 441981b (git: simplify environment > >>> save/restore logic - 2016-01-26). It's just a matter of choosing the > >>> right syntax. I'm going with '!!'. I'm not very happy with it. But I > >>> do like this type of alias. > >> > >> I do not know why you are not happy with the syntax, but I > >> personally think it brilliant, both the idea and the preliminary > >> clean-up that made this possible with a simple patch like this. > > > > I guess he is not happy with it because "!!" is quite unintuitive a > > construct. I know that *I* would have been puzzled by it, asking "What the > > heck does this do?". > > Well, "!" as a prefix is not intuitive either.
You do not use vi, do you? :-P
In vi, if you enter command mode (typing a colon) and then want to execute, say, `pwd`, you type !pwd<Enter>
> Perhaps "!.", because "." is current directory, and the "." command > (that is, alias to "source") doesn't make sense in git aliases.
If you want to execute, say, `pwd` in the current directory, that would mean you want to write
!.pwd
But that already means "execute `.pwd`"...
> Note that we would have to teach git completion about new syntax; > or new configuration variable if we go that route.
Why would we? Git's completion does not expand aliases, it only completes the aliases' names, not their values.
Ciao, Dscho