All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Elijah Newren <newren@gmail.com>
Cc: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 2/2] merge: avoid searching for strategies with fewer than 0 conflicts
Date: Mon, 22 Aug 2022 09:19:15 -0700	[thread overview]
Message-ID: <xmqqr118dzek.fsf@gitster.g> (raw)
In-Reply-To: <CABPp-BHy-Xs0S1-9kL7X4mi6JNfd420-vpVsswXNuXsc5C7AtA@mail.gmail.com> (Elijah Newren's message of "Mon, 22 Aug 2022 08:00:00 -0700")

Elijah Newren <newren@gmail.com> writes:

> No, the original code would not have taken 'ort'.  You have overlooked
> the part of the code immediately above these two lines:
>
>     if (ret < 2) {
>         if (!ret) {
>             if (option_commit) {
>                 /* Automerge succeeded. */
>                 automerge_was_ok = 1;
>                 break;
>             }
>         merge_was_ok = 1;
>         }
>
> In particular, the "break" is key.

I noticed that much but then would "git merge --no-commit -s A -s B"
have the issue?

> ...  In contrast, if the user did specify
> --no-commit and the previous strategy succeeded, then we will continue
> the loop.  That seems rather inconsistent, since --no-commit should
> not affect the choice of strategy.

Yeah, exactly.

> However, I missed two things in my reading.  You are correct that I
> missed the "<=" as opposed to "<" when I wrote my commit message,
> though that turns out to not matter much due to the second thing.  The
> second thing I missed was part of the code at the beginning of the
> loop:
>
>     for (i = 0; !merge_was_ok && i < use_strategies_nr; i++) {

Ahhhh, that explains it.  We leave as soon as we find merge_was_ok
so this patch is not necessary.  There is nothing to fix.  The
original was fine as-is.

Thanks.



  reply	other threads:[~2022-08-22 16:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-21  4:38 [PATCH 0/2] Miscellaneous merge fixes Elijah Newren via GitGitGadget
2022-08-21  4:38 ` [PATCH 1/2] merge: only apply autostash when appropriate Elijah Newren via GitGitGadget
2022-08-21  4:52   ` Eric Sunshine
2022-08-21  5:18     ` Elijah Newren
2022-08-21  4:38 ` [PATCH 2/2] merge: avoid searching for strategies with fewer than 0 conflicts Elijah Newren via GitGitGadget
2022-08-21 18:05   ` Junio C Hamano
2022-08-22 15:00     ` Elijah Newren
2022-08-22 16:19       ` Junio C Hamano [this message]
2022-08-23  1:18         ` Elijah Newren
2022-08-23  2:42 ` [PATCH v2 0/3] Miscellaneous merge fixes Elijah Newren via GitGitGadget
2022-08-23  2:42   ` [PATCH v2 1/3] merge: only apply autostash when appropriate Elijah Newren via GitGitGadget
2022-08-23  2:42   ` [PATCH v2 2/3] merge: cleanup confusing logic for handling successful merges Elijah Newren via GitGitGadget
2022-08-23  2:42   ` [PATCH v2 3/3] merge: small code readability improvement Elijah Newren via GitGitGadget
2022-08-23  3:03   ` [PATCH v2 0/3] Miscellaneous merge fixes Elijah Newren
2022-08-24 21:09     ` 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=xmqqr118dzek.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=newren@gmail.com \
    /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.