t4150: am --resolved fails if index has no changes
Since 6d28644 (git-am: do not allow empty commits by mistake., 2006-02-23), git-am --resolved will check to see if the index has any changes to prevent the user from creating an empty commit by mistake. Add a test for this. Reviewed-by: Stefan Beller <sbeller@google.com> Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Paul Tan committed
Jul 19, 2015 at 23:49 UTC
60ff7f9f5c818d1e59daa47467c61ad53be2c5ec
1 file changed
+12
t/t4150-am.sh
+12
@@ -425,6 +425,18 @@ test_expect_success 'am --resolved works' '
425
test_cmp expected another
426
'
427
428
+test_expect_success 'am --resolved fails if index has no changes' '
429
+ rm -fr .git/rebase-apply &&
430
+ git reset --hard &&
431
+ git checkout lorem2^^ &&
432
+ test_must_fail git am lorem-move.patch &&
433
+ test_path_is_dir .git/rebase-apply &&
434
+ test_cmp_rev lorem2^^ HEAD &&
435
+ test_must_fail git am --resolved &&
436
+ test_path_is_dir .git/rebase-apply &&
437
+ test_cmp_rev lorem2^^ HEAD
438
+'
439
+
440
test_expect_success 'am takes patches from a Pine mailbox' '
441
rm -fr .git/rebase-apply &&
442
git reset --hard &&