am: fix incorrect exit status on am fail to abort

Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Sep 10, 2021 at 10:31 UTC c5ead19ea282a288e01d86536349a4ae4a093e4b
2 files changed +3 -2
builtin/am.c
+2 -1
@@ -2106,7 +2106,8 @@ static void am_abort(struct am_state *state)
2106 if (!has_orig_head)
2107 oidcpy(&orig_head, the_hash_algo->empty_tree);
2108
2109 - clean_index(&curr_head, &orig_head);
2109 + if (clean_index(&curr_head, &orig_head))
2110 + die(_("failed to clean index"));
2111
2112 if (has_orig_head)
2113 update_ref("am --abort", "HEAD", &orig_head,
t/t4151-am-abort.sh
+1 -1
@@ -197,7 +197,7 @@ test_expect_success 'am --abort leaves index stat info alone' '
197 git diff-files --exit-code --quiet
198 '
199
200 -test_expect_failure 'git am --abort return failed exit status when it fails' '
200 +test_expect_success 'git am --abort return failed exit status when it fails' '
201 test_when_finished "rm -rf file-2/ && git reset --hard && git am --abort" &&
202 git checkout changes &&
203 git format-patch -1 --stdout conflicting >changes.mbox &&