summaryrefslogtreecommitdiff
path: root/builtin/stash.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-01-27 06:22:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-01-27 06:22:24 (GMT)
commitb23dac905bde28da47543484320db16312c87551 (patch)
tree8d15d93247a153e3e58da7530285679d46420ec0 /builtin/stash.c
parent7747e12d7147480aa32d2ab9b92ff90016226149 (diff)
parentff5b7913f0af62c26682b0376d0aa2d7f5d74b2e (diff)
downloadgit-b23dac905bde28da47543484320db16312c87551.zip
git-b23dac905bde28da47543484320db16312c87551.tar.gz
git-b23dac905bde28da47543484320db16312c87551.tar.bz2
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/stash.c')
-rw-r--r--builtin/stash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/stash.c b/builtin/stash.c
index 1ef2017..86cd0b4 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)