summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-01-26 22:22:24 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-01-26 22:22:24 -0800
commitb23dac905bde28da47543484320db16312c87551 (patch)
tree8d15d93247a153e3e58da7530285679d46420ec0 /builtin
parentStart post 2.35 cycle (diff)
parentsequencer, stash: fix running from worktree subdir (diff)
downloadtgif-b23dac905bde28da47543484320db16312c87551.tar.xz
Merge branch 'en/keep-cwd'
Fix a regression in 2.35 that roke the use of "rebase" and "stash" in a secondary worktree. * en/keep-cwd: sequencer, stash: fix running from worktree subdir
Diffstat (limited to 'builtin')
-rw-r--r--builtin/stash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/stash.c b/builtin/stash.c
index 1ef2017c59..86cd0b456e 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -1539,8 +1539,12 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
struct child_process cp = CHILD_PROCESS_INIT;
cp.git_cmd = 1;
- if (startup_info->original_cwd)
+ if (startup_info->original_cwd) {
cp.dir = startup_info->original_cwd;
+ strvec_pushf(&cp.env_array, "%s=%s",
+ GIT_WORK_TREE_ENVIRONMENT,
+ the_repository->worktree);
+ }
strvec_pushl(&cp.args, "clean", "--force",
"--quiet", "-d", ":/", NULL);
if (include_untracked == INCLUDE_ALL_FILES)