Re: [PATCH 3/4] add: introduce '--resolved' option

Michael Montalbo <[email protected]> Sat, 1 Aug 2026 17:49:40 -0700
Newsgroups org.kernel.vger.git
Message-ID <CAC2QwmJeohdnWhUbcP6Pc5w1X8yZf3jXvpR8JC=Hb9gqkFF6ig@mail.gmail.com>
On Wed, Jul 29, 2026 at 8:17=E2=80=AFAM Junio C Hamano <[email protected]> =
wrote:
>
>
> Left unchecked, this loop may end up scanning a large binary file to
> the end in vain.  We may squeeze in something like this to punt
> early.
>
>  merge-ll.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/merge-ll.c b/merge-ll.c
> index 5e5044b9e3..ef5287dee8 100644
> --- a/merge-ll.c
> +++ b/merge-ll.c
> @@ -516,6 +516,9 @@ int has_conflict_markers(struct index_state *istate, =
const char *path)
>                         has_markers =3D 1;
>                         break;
>                 }
> +               if (buffer_is_binary(sb.buf,
> +                                    ULONG_MAX <=3D sb.len ? ULONG_MAX : =
sb.len))
> +                       break;
>         }

Should this check be before the conflict marker line check in case the firs=
t
iteration accidentally matches for a binary file and breaks with
has_markers =3D 1?