Merge branch 'jk/format-patch-from' into maint
[gitweb.git] / t / t3903-stash.sh
index 8ff039bdfaeaea7382aef7fabd329cd17ff2027d..debda7a678277e1198ba6620210b66984caf03a2 100755 (executable)
@@ -200,17 +200,17 @@ test_expect_success 'apply -q is quiet' '
        echo foo > file &&
        git stash &&
        git stash apply -q > output.out 2>&1 &&
-       test ! -s output.out
+       test_must_be_empty output.out
 '
 
 test_expect_success 'save -q is quiet' '
        git stash save --quiet > output.out 2>&1 &&
-       test ! -s output.out
+       test_must_be_empty output.out
 '
 
 test_expect_success 'pop -q is quiet' '
        git stash pop -q > output.out 2>&1 &&
-       test ! -s output.out
+       test_must_be_empty output.out
 '
 
 test_expect_success 'pop -q --index works and is quiet' '
@@ -219,13 +219,13 @@ test_expect_success 'pop -q --index works and is quiet' '
        git stash save --quiet &&
        git stash pop -q --index > output.out 2>&1 &&
        test foo = "$(git show :file)" &&
-       test ! -s output.out
+       test_must_be_empty output.out
 '
 
 test_expect_success 'drop -q is quiet' '
        git stash &&
        git stash drop -q > output.out 2>&1 &&
-       test ! -s output.out
+       test_must_be_empty output.out
 '
 
 test_expect_success 'stash -k' '
@@ -654,4 +654,23 @@ 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_done