Skip to content

Commit 60ff7f9

Browse files
pyokagangitster
authored andcommitted
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>
1 parent b4967ab commit 60ff7f9

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

t/t4150-am.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,18 @@ test_expect_success 'am --resolved works' '
425425
test_cmp expected another
426426
'
427427

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+
428440
test_expect_success 'am takes patches from a Pine mailbox' '
429441
rm -fr .git/rebase-apply &&
430442
git reset --hard &&

0 commit comments

Comments
 (0)