]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Add test: git stash shows status relative to current dir
authorPiotr Krukowiecki <piotr.krukowiecki@gmail.com>
Mon, 14 Mar 2011 19:19:36 +0000 (20:19 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Mar 2011 04:45:11 +0000 (21:45 -0700)
[jc: moved "cd subdir" inside subshell and fixed comparison with expected]

Signed-off-by: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3903-stash.sh

index 6fd560ccf10db5d016a4f1dde9e5eacca70e6f5b..f62aaf5816f6ecf4e2c4e8fe5ae60925e61ccfcd 100755 (executable)
@@ -556,4 +556,23 @@ test_expect_success 'stash branch should not drop the stash if the branch exists
        git rev-parse stash@{0} --
 '
 
+test_expect_success 'stash apply shows status same as git status (relative to current directory)' '
+       git stash clear &&
+       echo 1 >subdir/subfile1 &&
+       echo 2 >subdir/subfile2 &&
+       git add subdir/subfile1 &&
+       git commit -m subdir &&
+       (
+               cd subdir &&
+               echo x >subfile1 &&
+               echo x >../file &&
+               git status >../expect &&
+               git stash &&
+               sane_unset GIT_MERGE_VERBOSITY &&
+               git stash apply
+       ) |
+       sed -e 1,2d >actual && # drop "Saved..." and "HEAD is now..."
+       test_cmp expect actual
+'
+
 test_done