File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ USAGE="list [<options>]
12
12
13
13
SUBDIRECTORY_OK=Yes
14
14
OPTIONS_SPEC=
15
+ START_DIR=` pwd`
15
16
. git-sh-setup
16
17
require_work_tree
17
18
cd_to_toplevel
@@ -393,7 +394,7 @@ apply_stash () {
393
394
then
394
395
squelch=' >/dev/null 2>&1'
395
396
fi
396
- eval " git status $squelch " || :
397
+ (cd " $START_DIR " && eval " git status $squelch " ) || :
397
398
else
398
399
# Merge conflict; keep the exit status from merge-recursive
399
400
status=$?
Original file line number Diff line number Diff line change @@ -556,4 +556,23 @@ test_expect_success 'stash branch should not drop the stash if the branch exists
556
556
git rev-parse stash@{0} --
557
557
'
558
558
559
+ test_expect_success ' stash apply shows status same as git status (relative to current directory)' '
560
+ git stash clear &&
561
+ echo 1 >subdir/subfile1 &&
562
+ echo 2 >subdir/subfile2 &&
563
+ git add subdir/subfile1 &&
564
+ git commit -m subdir &&
565
+ (
566
+ cd subdir &&
567
+ echo x >subfile1 &&
568
+ echo x >../file &&
569
+ git status >../expect &&
570
+ git stash &&
571
+ sane_unset GIT_MERGE_VERBOSITY &&
572
+ git stash apply
573
+ ) |
574
+ sed -e 1,2d >actual && # drop "Saved..." and "HEAD is now..."
575
+ test_cmp expect actual
576
+ '
577
+
559
578
test_done
You can’t perform that action at this time.
0 commit comments