[PATCH] Set GIT_PATHNAME_PREFIX with aliases.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]