All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH 2/4] merge: fix Yoda conditions
Date: Sun, 13 Jun 2021 17:58:34 -0500	[thread overview]
Message-ID: <20210613225836.1009569-3-felipe.contreras@gmail.com> (raw)
In-Reply-To: <20210613225836.1009569-1-felipe.contreras@gmail.com>

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 builtin/merge-file.c | 2 +-
 xdiff/xmerge.c       | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/merge-file.c b/builtin/merge-file.c
index 0186f4156a..6affccaf19 100644
--- a/builtin/merge-file.c
+++ b/builtin/merge-file.c
@@ -51,7 +51,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
 	if (startup_info->have_repository) {
 		/* Read the configuration file */
 		git_config(git_xmerge_config, NULL);
-		if (0 <= git_xmerge_style)
+		if (git_xmerge_style >= 0)
 			xmp.style = git_xmerge_style;
 	}
 
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
index 1659edb453..ab3448ca88 100644
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
@@ -487,7 +487,7 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1,
 		 * "diff3 -m" output does not make sense for anything
 		 * more aggressive than XDL_MERGE_EAGER.
 		 */
-		if (XDL_MERGE_EAGER < level)
+		if (level > XDL_MERGE_EAGER)
 			level = XDL_MERGE_EAGER;
 	}
 
@@ -603,10 +603,10 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1,
 	if (!changes)
 		changes = c;
 	/* refine conflicts */
-	if (XDL_MERGE_ZEALOUS <= level &&
+	if (level >= XDL_MERGE_ZEALOUS &&
 	    (xdl_refine_conflicts(xe1, xe2, changes, xpp) < 0 ||
 	     xdl_simplify_non_conflicts(xe1, changes,
-					XDL_MERGE_ZEALOUS < level) < 0)) {
+					level > XDL_MERGE_ZEALOUS) < 0)) {
 		xdl_cleanup_merge(changes);
 		return -1;
 	}
-- 
2.32.0


  parent reply	other threads:[~2021-06-13 22:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-13 22:58 [PATCH 0/4] merge: cleanups and fix Felipe Contreras
2021-06-13 22:58 ` [PATCH 1/4] merge: simplify initialization Felipe Contreras
2021-06-15 19:27   ` Ævar Arnfjörð Bjarmason
2021-06-17 22:35     ` Felipe Contreras
2021-06-13 22:58 ` Felipe Contreras [this message]
2021-06-13 22:58 ` [PATCH 3/4] xdiff/xmerge: simplify xdl_recs_copy_0 Felipe Contreras
2021-06-13 22:58 ` [PATCH 4/4] xdiff/xmerge: fix chg0 initialization Felipe Contreras
2021-06-14 15:34   ` Elijah Newren
2021-06-15  7:51     ` Felipe Contreras
2021-06-15 15:21       ` Elijah Newren

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=20210613225836.1009569-3-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.