summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorKyle Zhao <kylezhao@tencent.com>2024-06-17 03:08:37 +0000
committerJunio C Hamano <gitster@pobox.com>2024-06-18 08:13:35 -0700
commit2e5a63659301c46544fdb3c3e7a69b4693a2c384 (patch)
treea95b0e5e3cb5a4b988158055b2c6b5651524dfe3 /builtin/merge.c
parent66ac6e4bcd111be3fa9c2a6b3fafea718d00678d (diff)
merge: avoid write merge state when unable to write index
Writing the merge state after the index write fails is meaningless and could potentially cause Git to lose changes. Signed-off-by: Kyle Zhao <kylezhao@tencent.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index fb3eb15b89..888166d604 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -703,7 +703,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET,
SKIP_IF_UNCHANGED, 0, NULL, NULL,
NULL) < 0)
- return error(_("Unable to write index."));
+ die(_("Unable to write index."));
if (!strcmp(strategy, "recursive") || !strcmp(strategy, "subtree") ||
!strcmp(strategy, "ort")) {