summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/stash.c4
-rwxr-xr-xt/t2501-cwd-empty.sh2
2 files changed, 4 insertions, 2 deletions
diff --git a/builtin/stash.c b/builtin/stash.c
index a0ccc8654d..de0e432a4f 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -1485,8 +1485,10 @@ 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)
+ cp.dir = startup_info->original_cwd;
strvec_pushl(&cp.args, "clean", "--force",
- "--quiet", "-d", NULL);
+ "--quiet", "-d", ":/", NULL);
if (include_untracked == INCLUDE_ALL_FILES)
strvec_push(&cp.args, "-x");
if (run_command(&cp)) {
diff --git a/t/t2501-cwd-empty.sh b/t/t2501-cwd-empty.sh
index 52335a8afe..be9ef903bd 100755
--- a/t/t2501-cwd-empty.sh
+++ b/t/t2501-cwd-empty.sh
@@ -236,7 +236,7 @@ test_expect_success 'clean does not remove cwd incidentally' '
'
test_expect_success 'stash does not remove cwd incidentally' '
- test_incidental_untracked_dir_removal failure \
+ test_incidental_untracked_dir_removal success \
git stash --include-untracked
'