]> git.ipfire.org Git - thirdparty/git.git/commitdiff
am: fix incorrect exit status on am fail to abort
authorElijah Newren <newren@gmail.com>
Fri, 10 Sep 2021 10:31:16 +0000 (10:31 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Sep 2021 22:51:15 +0000 (15:51 -0700)
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/am.c
t/t4151-am-abort.sh

index 0c2ad96b70eef408492987a8b358887cc56dcb9c..c79e0167e98259494fdb13832d0ee63995311c08 100644 (file)
@@ -2106,7 +2106,8 @@ static void am_abort(struct am_state *state)
        if (!has_orig_head)
                oidcpy(&orig_head, the_hash_algo->empty_tree);
 
-       clean_index(&curr_head, &orig_head);
+       if (clean_index(&curr_head, &orig_head))
+               die(_("failed to clean index"));
 
        if (has_orig_head)
                update_ref("am --abort", "HEAD", &orig_head,
index 15f2f92cd76b177ae2cff6d943a04a6ba7ef02fd..2374151662b88ceec17777e01b823612fd8edfd4 100755 (executable)
@@ -197,7 +197,7 @@ test_expect_success 'am --abort leaves index stat info alone' '
        git diff-files --exit-code --quiet
 '
 
-test_expect_failure 'git am --abort return failed exit status when it fails' '
+test_expect_success 'git am --abort return failed exit status when it fails' '
        test_when_finished "rm -rf file-2/ && git reset --hard && git am --abort" &&
        git checkout changes &&
        git format-patch -1 --stdout conflicting >changes.mbox &&