Code

Update draft release notes to 1.7.6
[git.git] / git.c
diff --git a/git.c b/git.c
index 60a9403771879da0e39a456055e22844905aac68..a5ef3c69ff58434e521d2c42f1b2fa275b872828 100644 (file)
--- a/git.c
+++ b/git.c
@@ -185,6 +185,8 @@ static int handle_alias(int *argcp, const char ***argv)
                if (alias_string[0] == '!') {
                        const char **alias_argv;
                        int argc = *argcp, i;
+                       struct strbuf sb = STRBUF_INIT;
+                       const char *env[2];
 
                        commit_pager_choice();
 
@@ -195,7 +197,13 @@ static int handle_alias(int *argcp, const char ***argv)
                                alias_argv[i] = (*argv)[i];
                        alias_argv[argc] = NULL;
 
-                       ret = run_command_v_opt(alias_argv, RUN_USING_SHELL);
+                       strbuf_addstr(&sb, "GIT_PREFIX=");
+                       if (subdir)
+                               strbuf_addstr(&sb, subdir);
+                       env[0] = sb.buf;
+                       env[1] = NULL;
+                       ret = run_command_v_opt_cd_env(alias_argv, RUN_USING_SHELL, NULL, env);
+                       strbuf_release(&sb);
                        if (ret >= 0)   /* normal exit */
                                exit(ret);