t3903: add test for --intent-to-add file
authorMatthew Kraai <mkraai@its.jnj.com>
Mon, 25 Feb 2019 23:16:11 +0000 (23:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Mar 2019 00:41:40 +0000 (09:41 +0900)
Add a test showing the 'git stash' behaviour with a file that has been
added with 'git add --intent-to-add'. Stash fails to stash the file,
so the purpose of this test is mainly to make sure git doesn't crash,
but exits normally in this situation.

This is in preparation for converting stash into a builtin.

[tg: pulled the test out into a separate commit]

Signed-off-by: Matthew Kraai <mkraai@its.jnj.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3903-stash.sh
index 2fd4f01358251feeb910a00345218601ed6a97c8..78d50bcf1e17362b0d7051f4f7b5c3b4d182aedd 100755 (executable)
@@ -287,6 +287,14 @@ test_expect_success 'stash an added file' '
        test new = "$(cat file3)"
 '
 
        test new = "$(cat file3)"
 '
 
+test_expect_success 'stash --intent-to-add file' '
+       git reset --hard &&
+       echo new >file4 &&
+       git add --intent-to-add file4 &&
+       test_when_finished "git rm -f file4" &&
+       test_must_fail git stash
+'
+
 test_expect_success 'stash rm then recreate' '
        git reset --hard &&
        git rm file &&
 test_expect_success 'stash rm then recreate' '
        git reset --hard &&
        git rm file &&