Skip to content

Commit 6eaf92f

Browse files
cvbgegitster
authored andcommitted
Add test: git stash shows status relative to current dir
[jc: moved "cd subdir" inside subshell and fixed comparison with expected] Signed-off-by: Piotr Krukowiecki <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 26b59b4 commit 6eaf92f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

t/t3903-stash.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,4 +556,23 @@ test_expect_success 'stash branch should not drop the stash if the branch exists
556556
git rev-parse stash@{0} --
557557
'
558558

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+
559578
test_done

0 commit comments

Comments
 (0)