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>
This commit is contained in:
Elijah Newren 2021-09-10 10:31:16 +00:00 committed by Junio C Hamano
parent 42b5e09d1e
commit c5ead19ea2
2 changed files with 3 additions and 2 deletions

View 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,

View file

@ -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 &&