Re: [PATCH 9/9] am: make a direct call to merge_recursive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <johannes.schindelin@xxxxxx> writes:

> From: Junio C Hamano <gitster@xxxxxxxxx>

Did I write this thing?

Having two sets of numbers that illustrated that this is not really
a useful optimization in the bigger picture looks vaguely familiar
(e.g. $gmane/279417), but the numbers are different.

> 	It feels *slightly* wrong to submit your own patch to review,
> 	however, please keep in mind that
>
> 	1) I changed the patch (o.gently does not exist anymore, so I do
> 	   not set it), and
>
> 	2) I added my own timings performed on Windows.

It probably is much less confusing if you take the authorship,
possibly with a passing reference to whatever I wrote as the source
of inspiration in the log message, or something.  I do not think I
deserve a credit in this 9-patch series.

I haven't read the other 8 patches, so I cannot comment on it yet.

>  builtin/am.c | 27 ++++++++++++++-------------
>  1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/builtin/am.c b/builtin/am.c
> index 3dfe70b..dd41154 100644
> --- a/builtin/am.c
> +++ b/builtin/am.c
> @@ -1587,25 +1587,26 @@ static int run_fallback_merge_recursive(const struct am_state *state,
>  					unsigned char *our_tree,
>  					unsigned char *his_tree)
>  {
> -	struct child_process cp = CHILD_PROCESS_INIT;
> +	const unsigned char *bases[1] = {orig_tree};
> +	struct merge_options o;
> +	struct commit *result;
> +	char *his_tree_name;
>  	int status;
>  
> -	cp.git_cmd = 1;
> +	init_merge_options(&o);
> +
> +	o.branch1 = "HEAD";
> +	his_tree_name = xstrfmt("%.*s", linelen(state->msg), state->msg);
> +	o.branch2 = his_tree_name;
>  
> -	argv_array_pushf(&cp.env_array, "GITHEAD_%s=%.*s",
> -			 sha1_to_hex(his_tree), linelen(state->msg), state->msg);
>  	if (state->quiet)
> -		argv_array_push(&cp.env_array, "GIT_MERGE_VERBOSITY=0");
> +		o.verbosity = 0;
>  
> -	argv_array_push(&cp.args, "merge-recursive");
> -	argv_array_push(&cp.args, sha1_to_hex(orig_tree));
> -	argv_array_push(&cp.args, "--");
> -	argv_array_push(&cp.args, sha1_to_hex(our_tree));
> -	argv_array_push(&cp.args, sha1_to_hex(his_tree));
> +	status = merge_recursive_generic(&o, our_tree, his_tree, 1, bases, &result);
> +	if (status < 0)
> +		exit(128);
> +	free(his_tree_name);
>  
> -	status = run_command(&cp) ? (-1) : 0;
> -	discard_cache();
> -	read_cache();
>  	return status;
>  }
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]