summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-11-06 04:11:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-11-06 04:11:28 (GMT)
commite4db47e6a038adcde36ef6305a15d3d7ee49487c (patch)
tree2185327ef9b52e55f698c5e9c2e09c816a3b4a90 /sequencer.c
parent662ac3b3a8a16fd749b598c85c4d8bfea5bb208e (diff)
parent09d7b6c6fab3ad131b71016b61c80d39d532befd (diff)
downloadgit-e4db47e6a038adcde36ef6305a15d3d7ee49487c.zip
git-e4db47e6a038adcde36ef6305a15d3d7ee49487c.tar.gz
git-e4db47e6a038adcde36ef6305a15d3d7ee49487c.tar.bz2
Merge branch 'jk/rebase-i-exec-gitdir-fix'
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 46c997e..7c874be 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1861,12 +1861,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)
@@ -1896,6 +1899,8 @@ static int do_exec(const char *command_line)
status = 1;
}
+ argv_array_clear(&child_env);
+
return status;
}