git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Set GIT_PATHNAME_PREFIX with aliases.
@ 2010-05-05  0:25 Jared Hance
  2010-05-05  0:51 ` Jeff King
  0 siblings, 1 reply; 23+ messages in thread
From: Jared Hance @ 2010-05-05  0:25 UTC (permalink / raw)
  To: gitster; +Cc: git

The environment variable GIT_PATHNAME_PREFIX passes on the
current working directory (where the git command was called from)
to shell aliases (aliases that begin with "!"). This allows these
shell aliases to know the directory that the git command was called
from.

Signed-off-by: Jared Hance <jaredhance@gmail.com>
---
 git.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/git.c b/git.c
index 6bae305..836f753 100644
--- a/git.c
+++ b/git.c
@@ -167,6 +167,9 @@ static int handle_alias(int *argcp, const char ***argv)
 				free(alias_string);
 				alias_string = buf.buf;
 			}
+			static char current_dir[PATH_MAX+1];
+			setenv("GIT_PATHNAME_PREFIX", getcwd(current_dir, sizeof(current_dir)), 1);
+
 			trace_printf("trace: alias to shell cmd: %s => %s\n",
 				     alias_command, alias_string + 1);
 			ret = system(alias_string + 1);
-- 
1.7.0.4

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

end of thread, other threads:[~2010-05-06  7:03 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05  0:25 [PATCH] Set GIT_PATHNAME_PREFIX with aliases Jared Hance
2010-05-05  0:51 ` Jeff King
2010-05-05  6:53   ` Johannes Sixt
2010-05-05  7:01     ` Jeff King
2010-05-05  7:52       ` Eli Barzilay
2010-05-05 16:07         ` Junio C Hamano
2010-05-05 20:28           ` [PATCH] An alias that starts with "!!" runs in the current directory Eli Barzilay
2010-05-05 20:52             ` [PATCH] An alias that starts with &quot;!!&quot; " Jared Hance
2010-05-05 20:58               ` Eli Barzilay
2010-05-05 21:00                 ` Eli Barzilay
2010-05-05 21:24                   ` Re-submitting patches Jonathan Nieder
2010-05-05 21:28                     ` Eli Barzilay
2010-05-05 21:31             ` [PATCH v2] An alias that starts with "!!" runs in the current directory Eli Barzilay
2010-05-05 22:22               ` Will Palmer
2010-05-05 22:33                 ` Eli Barzilay
2010-05-05 23:43                 ` Junio C Hamano
2010-05-06  0:05                   ` Adam Brewster
2010-05-06  6:21                     ` Will Palmer
2010-05-06  6:26                   ` Will Palmer
2010-05-06  6:36                   ` Johannes Sixt
2010-05-06  7:02                   ` Matthieu Moy
2010-05-05 22:02             ` [PATCH] " Junio C Hamano
2010-05-05 22:13               ` Eli Barzilay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).