git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Izzy via GitGitGadget <gitgitgadget@gmail.com>, git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>, Jeff King <peff@peff.net>,
	Izzy <winglovet@gmail.com>
Subject: Re: [PATCH v6] merge-tree: add -X strategy option
Date: Mon, 9 Oct 2023 10:58:07 +0100	[thread overview]
Message-ID: <a482d047-dd40-436d-8daa-0c74780af11f@gmail.com> (raw)
In-Reply-To: <pull.1565.v6.git.1695522222723.gitgitgadget@gmail.com>

On 24/09/2023 03:23, Izzy via GitGitGadget wrote:

Thanks for updating the patch, sorry it has taken me a while to look at 
this.

> From: Tang Yuyi <winglovet@gmail.com>
> 
> Add merge strategy option to produce more customizable merge result such
> as automatically resolving conflicts.
> 
> Signed-off-by: Tang Yuyi <winglovet@gmail.com>
> ---

>   static int real_merge(struct merge_tree_options *o,
> @@ -423,7 +425,7 @@ static int real_merge(struct merge_tree_options *o,
>   {
>   	struct commit *parent1, *parent2;
>   	struct commit_list *merge_bases = NULL;
> -	struct merge_options opt;
> +	struct merge_options opt = o->merge_options;

Copying struct merge_options by value here is unusual in our code base. 
I don't think it introduces a bug (there is no function to free the 
resources allocated in struct merge_options so we do not end up freeing 
them twice for example) but it would be clearer that it was safe if you did

	struct merge_options *opt = &o->merge_options;

and updated the code to reflect that opt is now a pointer or just 
replaced all uses of "opt" with "o->merge_options"

> +	if (xopts.nr && o.mode == MODE_TRIVIAL)
> +		die(_("--trivial-merge is incompatible with all other options"));

This is good, thanks for adding it.

> +	for (int x = 0; x < xopts.nr; x++)

This is not worth a re-roll on its own but as xopts.nr is a size_t we 
should declare x to be the same type rather than an int.

The tests are pretty minimal, ideally we would check that "-X" works 
with "--stdin", that it is rejected by a trivial merge and that one of 
the other strategy options works.

Best Wishes

Phillip


  parent reply	other threads:[~2023-10-09  9:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-05 14:24 [PATCH] merge-tree: add -X strategy option Izzy via GitGitGadget
2023-08-07  2:10 ` Junio C Hamano
2023-08-12  5:33 ` [PATCH v2] " Izzy via GitGitGadget
2023-08-12  5:41   ` 唐宇奕
2023-09-03  1:31     ` 唐宇奕
2023-09-12 15:03   ` Elijah Newren
2023-09-16  2:14   ` [PATCH v3] " Izzy via GitGitGadget
2023-09-16  2:26     ` 唐宇奕
2023-09-16  3:21       ` Elijah Newren
2023-09-16  3:16     ` Elijah Newren
2023-09-16  3:47     ` [PATCH v4] " Izzy via GitGitGadget
2023-09-16  3:55       ` Elijah Newren
2023-09-16  4:04       ` 唐宇奕
2023-09-16  6:11       ` Jeff King
2023-09-16  8:37       ` [PATCH v5] " Izzy via GitGitGadget
2023-09-16  8:38         ` 唐宇奕
2023-09-18  9:53         ` Phillip Wood
2023-09-18 16:08           ` Junio C Hamano
2023-09-24  2:23         ` [PATCH v6] " Izzy via GitGitGadget
2023-09-24  2:26           ` 唐宇奕
2023-10-09  9:58           ` Phillip Wood [this message]
2023-10-09 15:53             ` Jeff King
2023-10-09 17:10               ` Junio C Hamano
2023-10-09 18:52                 ` Jeff King
2023-10-11 19:38                   ` Junio C Hamano
2023-10-11 21:43                     ` Jeff King
2023-10-11 22:19                       ` 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=a482d047-dd40-436d-8daa-0c74780af11f@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=winglovet@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).