X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft3903-stash.sh;h=7484cbede6ccd3ecb56a3ebff734740cb543c0a4;hb=1d49f0d1a1b7b2941e56cf8384a7a4267e98150c;hp=aa282e1bc1e17f08dd12fc1980187c786f1de99b;hpb=60e3cad92ed93120b9e77116163b267fdda44f91;p=git.git diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index aa282e1bc..7484cbede 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Johannes E Schindelin # -test_description='Test git-stash' +test_description='Test git stash' . ./test-lib.sh @@ -34,14 +34,14 @@ EOF test_expect_success 'parents of stash' ' test $(git rev-parse stash^) = $(git rev-parse HEAD) && git diff stash^2..stash > output && - diff -u output expect + test_cmp output expect ' test_expect_success 'apply needs clean working directory' ' echo 4 > other-file && git add other-file && echo 5 > other-file && - test_must_fail git stash apply + test_must_fail git stash apply ' test_expect_success 'apply stashed changes' ' @@ -117,4 +117,64 @@ test_expect_success 'stash pop' ' test 0 = $(git stash list | wc -l) ' +cat > expect << EOF +diff --git a/file2 b/file2 +new file mode 100644 +index 0000000..1fe912c +--- /dev/null ++++ b/file2 +@@ -0,0 +1 @@ ++bar2 +EOF + +cat > expect1 << EOF +diff --git a/file b/file +index 257cc56..5716ca5 100644 +--- a/file ++++ b/file +@@ -1 +1 @@ +-foo ++bar +EOF + +cat > expect2 << EOF +diff --git a/file b/file +index 7601807..5716ca5 100644 +--- a/file ++++ b/file +@@ -1 +1 @@ +-baz ++bar +diff --git a/file2 b/file2 +new file mode 100644 +index 0000000..1fe912c +--- /dev/null ++++ b/file2 +@@ -0,0 +1 @@ ++bar2 +EOF + +test_expect_success 'stash branch' ' + echo foo > file && + git commit file -m first + echo bar > file && + echo bar2 > file2 && + git add file2 && + git stash && + echo baz > file && + git commit file -m second && + git stash branch stashbranch && + test refs/heads/stashbranch = $(git symbolic-ref HEAD) && + test $(git rev-parse HEAD) = $(git rev-parse master^) && + git diff --cached > output && + test_cmp output expect && + git diff > output && + test_cmp output expect1 && + git add file && + git commit -m alternate\ second && + git diff master..stashbranch > output && + test_cmp output expect2 && + test 0 = $(git stash list | wc -l) +' + test_done