Re: [PATCH 6/7] merge-ort: upon merge abort, only show messages causing the abort

Elijah Newren
2024-06-19T02:59:10Z

On Fri, Jun 14, 2024 at 4:19 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
>
> On Thu, Jun 13, 2024 at 4:25 PM Elijah Newren via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> > When something goes wrong enough that we need to abort early and not
> > even attempt merging the remaining files, it probably does not make
> > sense to report conflicts messages for the subset of files we processed
> > before hitting the fatal error. Instead, only show the messages
> > associated with paths where we hit the fatal error. Also, print these
> > messages to stderr rather than stdout.
> >
> > Signed-off-by: Elijah Newren <newren@gmail.com>
> > ---
> > diff --git a/merge-ort.c b/merge-ort.c
> > @@ -543,10 +543,24 @@ enum conflict_and_info_types {
> > - CONFLICT_SUBMODULE_CORRUPT,
> > +
> > + /* INSERT NEW ENTRIES HERE */
> > + /*
> > + * Something is seriously wrong; cannot even perform merge;
> > + * Keep this group _last_ other than NB_CONFLICT_TYPES
> > + */
>
> I'm probably missing something obvious, but here the new comment talks
> about NB_CONFLICT_TYPES...
>
> > + ERROR_SUBMODULE_CORRUPT,
> >
> > /* Keep this entry _last_ in the list */
> > - NB_CONFLICT_TYPES,
> > + NB_TOTAL_TYPES,
>
> ... but NB_CONFLICT_TYPES gets removed here.
>
> > @@ -1828,9 +1845,9 @@ static int merge_submodule(struct merge_options *opt,
> > - _("Failed to merge submodule %s "
> > + _("error: failed to merge submodule %s "
> > @@ -1848,7 +1865,7 @@ static int merge_submodule(struct merge_options *opt,
> > _("Failed to merge submodule %s "
> > "(repository corrupt)"),
>
> Do you also want to apply the same "error: failed..." transformation
> to this error message as you did to other error messages?

Doh, I tried to re-read through my patches after making numerous
additional tweaks to try to catch stuff like this, but I clearly
missed a few cases here. Thanks for catching both of these issues;
I'll fix them up.