diff mbox series

[v5,1/8] merge-ort-wrappers: make printed message match the one from recursive

Message ID bd36d16c8d93176bac12acaf90f654a0acb16cd6.1658541198.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit 11f4290001989fcd071e59382be0574a87be68fe
Headers show
Series Fix merge restore state | expand

Commit Message

Elijah Newren July 23, 2022, 1:53 a.m. UTC
From: Elijah Newren <newren@gmail.com>

When the index does not match HEAD, the merge strategies are responsible
to detect that condition and abort.  The merge-ort-wrappers had code to
implement this and meant to copy the error message from merge-recursive
but deviated in two ways, both due to the message in merge-recursive
being processed by another function that made additional changes:
  * It added an implicit "error: " prefix
  * It added an implicit trailing newline
We can get these things by making use of the error() function.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 merge-ort-wrappers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c
index ad041061695..748924a69ba 100644
--- a/merge-ort-wrappers.c
+++ b/merge-ort-wrappers.c
@@ -10,8 +10,8 @@  static int unclean(struct merge_options *opt, struct tree *head)
 	struct strbuf sb = STRBUF_INIT;
 
 	if (head && repo_index_has_changes(opt->repo, head, &sb)) {
-		fprintf(stderr, _("Your local changes to the following files would be overwritten by merge:\n  %s"),
-		    sb.buf);
+		error(_("Your local changes to the following files would be overwritten by merge:\n  %s"),
+		      sb.buf);
 		strbuf_release(&sb);
 		return -1;
 	}