summary refs log tree commit diff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-12-21 15:03:15 -0800
committerJunio C Hamano <gitster@pobox.com>2021-12-21 15:03:15 -0800
commit57f28f40943c077ef1dc11c693d693b1bd6b7f2f (patch)
tree635b6b07251371c7cac312e6596bac5a43940859 /sequencer.c
parent5a4069a1d86d98e3ba3f6aa748b5ad323983c420 (diff)
parent434e0636db102cd89292ea28e8e947fa6e790b23 (diff)
Merge branch 'en/rebase-x-wo-git-dir-env'
"git rebase -x" by mistake started exporting the GIT_DIR and
GIT_WORK_TREE environment variables when the command was rewritten
in C, which has been corrected.

* en/rebase-x-wo-git-dir-env:
  sequencer: do not export GIT_DIR and GIT_WORK_TREE for 'exec'
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/sequencer.c b/sequencer.c
index b69ef4dd4e..e314af4d60 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3497,17 +3497,12 @@ static int error_failed_squash(struct repository *r,
 
 static int do_exec(struct repository *r, const char *command_line)
 {
-	struct strvec child_env = STRVEC_INIT;
 	const char *child_argv[] = { NULL, NULL };
 	int dirty, status;
 
 	fprintf(stderr, _("Executing: %s\n"), command_line);
 	child_argv[0] = command_line;
-	strvec_pushf(&child_env, "GIT_DIR=%s", absolute_path(get_git_dir()));
-	strvec_pushf(&child_env, "GIT_WORK_TREE=%s",
-		     absolute_path(get_git_work_tree()));
-	status = run_command_v_opt_cd_env(child_argv, RUN_USING_SHELL, NULL,
-					  child_env.v);
+	status = run_command_v_opt(child_argv, RUN_USING_SHELL);
 
 	/* force re-reading of the cache */
 	if (discard_index(r->index) < 0 || repo_read_index(r) < 0)
@@ -3537,8 +3532,6 @@ static int do_exec(struct repository *r, const char *command_line)
 		status = 1;
 	}
 
-	strvec_clear(&child_env);
-
 	return status;
 }