[PATCH] Set GIT_PATHNAME_PREFIX with aliases.
- From
Jared Hance <jaredhance@gmail.com>
- Date
- May 5, 2010, 00:25 UTC
- Message-ID
- <1273019122.16093.6.camel@ubuntu.ubuntu-domain>
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