aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2021-09-10 10:31:16 +0000
committerJunio C Hamano <gitster@pobox.com>2021-09-10 15:51:15 -0700
commitc5ead19ea282a288e01d86536349a4ae4a093e4b (patch)
treee996a253543c31cb895adbbf9f3d64a3f3af020f
parentt4151: add a few am --abort tests (diff)
downloadgit-c5ead19ea282a288e01d86536349a4ae4a093e4b.tar.gz
git-c5ead19ea282a288e01d86536349a4ae4a093e4b.zip
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>
-rw-r--r--builtin/am.c3
-rwxr-xr-xt/t4151-am-abort.sh2
2 files changed, 3 insertions, 2 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 0c2ad96b70..c79e0167e9 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -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,
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 15f2f92cd7..2374151662 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -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 &&