From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 3/4] rerere: try_merge() should use LL_MERGE_ERROR when it means an error
Date: Thu, 24 Aug 2023 13:54:55 -0700 [thread overview]
Message-ID: <20230824205456.1231371-4-gitster@pobox.com> (raw)
In-Reply-To: <20230824205456.1231371-1-gitster@pobox.com>
When the preimage or the postimage files cannot be read, the
try_merge() helper function returns LL_MERGE_CONFLICT. To all of
its callers, this does not make them do wrong things per-se, as they
are only checking if the result is 0 and LL_MERGE_CONFLICT is not 0.
But it is an error if we fail to read the input we expect to be able
to read; return LL_MERGE_ERROR instead. This does not change any
behaviour---it just makes the code use the "correct" constant to
signal an error.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
rerere.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rerere.c b/rerere.c
index 4ce1270a94..6bc3c54d3b 100644
--- a/rerere.c
+++ b/rerere.c
@@ -617,7 +617,7 @@ static int try_merge(struct index_state *istate,
if (read_mmfile(&base, rerere_path(id, "preimage")) ||
read_mmfile(&other, rerere_path(id, "postimage"))) {
- ret = LL_MERGE_CONFLICT;
+ ret = LL_MERGE_ERROR;
} else {
/*
* A three-way merge. Note that this honors user-customizable
--
2.42.0-29-gcd9da15a85
next prev parent reply other threads:[~2023-08-24 20:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 20:54 [PATCH 0/4] code clean-up for rerere Junio C Hamano
2023-08-24 20:54 ` [PATCH 1/4] rerere: simplify check_one_conflict() helper function Junio C Hamano
2023-08-24 20:54 ` [PATCH 2/4] rerere: fix comment on handle_file() helper Junio C Hamano
2023-08-24 20:54 ` Junio C Hamano [this message]
2023-08-24 20:54 ` [PATCH 4/4] rerere: modernize use of empty strbuf Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230824205456.1231371-4-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).