aboutsummaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-11-15 12:04:56 +0900
committerJunio C Hamano <gitster@pobox.com>2017-11-15 12:04:56 +0900
commitadfc49e60bb1ae4e1239d8fd5d35127de160058b (patch)
tree6126472166194d4bbd1c687d37ad2324fb501471 /sequencer.c
parentfd7c38c7937a25da55943187a29462c3fa7fb487 (diff)
parent09d7b6c6fab3ad131b71016b61c80d39d532befd (diff)
downloadgit-adfc49e60bb1ae4e1239d8fd5d35127de160058b.tar.gz
git-adfc49e60bb1ae4e1239d8fd5d35127de160058b.tar.xz
Merge branch 'jk/rebase-i-exec-gitdir-fix' into maint
A recent regression in "git rebase -i" that broke execution of git commands from subdirectories via "exec" insn has been fixed. * jk/rebase-i-exec-gitdir-fix: sequencer: pass absolute GIT_DIR to exec commands
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c
index f2a10cc4f..332a383b0 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1862,12 +1862,15 @@ static int error_failed_squash(struct commit *commit,
static int do_exec(const char *command_line)
{
+ struct argv_array child_env = ARGV_ARRAY_INIT;
const char *child_argv[] = { NULL, NULL };
int dirty, status;
fprintf(stderr, "Executing: %s\n", command_line);
child_argv[0] = command_line;
- status = run_command_v_opt(child_argv, RUN_USING_SHELL);
+ argv_array_pushf(&child_env, "GIT_DIR=%s", absolute_path(get_git_dir()));
+ status = run_command_v_opt_cd_env(child_argv, RUN_USING_SHELL, NULL,
+ child_env.argv);
/* force re-reading of the cache */
if (discard_cache() < 0 || read_cache() < 0)
@@ -1897,6 +1900,8 @@ static int do_exec(const char *command_line)
status = 1;
}
+ argv_array_clear(&child_env);
+
return status;
}