Cygwin 1.7 needs compat/regex
[gitweb.git] / t / t3903-stash.sh
index 634b2b74f49558781f612e3044d99cbc6fa3e657..5d22f17ca2d3469c7542805e365246a70a5fba64 100755 (executable)
@@ -654,4 +654,41 @@ test_expect_success 'stash where working directory contains "HEAD" file' '
        test_cmp output expect
 '
 
+test_expect_success 'store called with invalid commit' '
+       test_must_fail git stash store foo
+'
+
+test_expect_success 'store updates stash ref and reflog' '
+       git stash clear &&
+       git reset --hard &&
+       echo quux >bazzy &&
+       git add bazzy &&
+       STASH_ID=$(git stash create) &&
+       git reset --hard &&
+       ! grep quux bazzy &&
+       git stash store -m quuxery $STASH_ID &&
+       test $(cat .git/refs/stash) = $STASH_ID &&
+       grep $STASH_ID .git/logs/refs/stash &&
+       git stash pop &&
+       grep quux bazzy
+'
+
+test_expect_success 'stash a change to turn a non-directory to a directory' '
+       git reset --hard &&
+       >testfile &&
+       git add testfile &&
+       git commit -m "add testfile as a regular file" &&
+       rm testfile &&
+       mkdir testfile &&
+       >testfile/file &&
+       test_must_fail git stash save "recover regular file" &&
+       test -f testfile/file
+'
+
+test_expect_success 'stash a change to turn a non-directory to a directory (forced)' '
+       git stash save --force "recover regular file (forced)" &&
+       ! test -f testfile/file &&
+       test -f testfile
+'
+
 test_done