]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/stash.c
Merge branch 'en/keep-cwd'
[thirdparty/git.git] / builtin / stash.c
index 1ef2017c595dc09d09457affb3f5e3c3a0e352ab..86cd0b456e7752d7ffdb578ce892ca17c4e9c6a9 100644 (file)
@@ -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)