All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] git.c: support "!!" aliases that do not move cwd
@ 2016-10-06 11:41 Nguyễn Thái Ngọc Duy
  2016-10-06 18:42 ` Junio C Hamano
  2016-10-06 19:00 ` Jeff King
  0 siblings, 2 replies; 34+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2016-10-06 11:41 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

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.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 git.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/git.c b/git.c
index 296857a..4c1dcf4 100644
--- a/git.c
+++ b/git.c
@@ -252,6 +252,10 @@ static int handle_alias(int *argcp, const char ***argv)
 
 			alias_string++;
 			commit_pager_choice();
+			if (*alias_string == '!') {
+				keep_cwd = 0;
+				alias_string++;
+			}
 			restore_env(keep_cwd);
 
 			child.use_shell = 1;
-- 
2.8.2.524.g6ff3d78


^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2016-10-26 16:09 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 11:41 [PATCH/RFC] git.c: support "!!" aliases that do not move cwd Nguyễn Thái Ngọc Duy
2016-10-06 18:42 ` Junio C Hamano
2016-10-07 11:20   ` Johannes Schindelin
2016-10-07 12:27     ` Duy Nguyen
2016-10-07 12:47       ` Matthieu Moy
2016-10-07 13:07         ` Duy Nguyen
2016-10-07 14:12         ` Johannes Schindelin
2016-10-07 14:31           ` Matthieu Moy
2016-10-07 14:11       ` Johannes Schindelin
2016-10-07 14:20         ` Jeff King
2016-10-07 17:42       ` Johannes Sixt
2016-10-07 17:50         ` Jeff King
2016-10-08  8:36           ` Johannes Schindelin
2016-10-09  6:01             ` Jeff King
2016-10-09  6:08               ` Jeff King
2016-10-09 11:32               ` Duy Nguyen
2016-10-09 20:58                 ` Jeff King
2016-10-10 17:52                   ` Junio C Hamano
2016-10-10 18:21                     ` Jeff King
2016-10-10 19:07                       ` Junio C Hamano
2016-10-11  9:44                   ` Johannes Schindelin
2016-10-11 10:53                     ` Duy Nguyen
2016-10-11 11:28                       ` Johannes Schindelin
2016-10-11 15:01                     ` Jeff King
2016-10-26 13:23                       ` Duy Nguyen
2016-10-26 16:08                         ` Junio C Hamano
2016-10-07 13:31     ` Jakub Narębski
2016-10-07 14:19       ` Johannes Schindelin
2016-10-07 15:55         ` Jakub Narębski
2016-10-08  0:32           ` Duy Nguyen
2016-10-11 11:51             ` SZEDER Gábor
2016-10-11 13:24               ` Jakub Narębski
2016-10-06 19:00 ` Jeff King
2016-10-06 19:07   ` Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.