Re: [PATCH 9/9] am: make a direct call to merge_recursive
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jul 1, 2016, 12:46 UTC
- Message-ID
- <alpine.DEB.2.20.1607011442510.12947@virtualbox>
- In-Reply-To
- <xmqq37nv3d19.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Wed, 29 Jun 2016, Junio C Hamano wrote:
Show 38 quoted lines
> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
>
> > - 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;
> > }
>
> Is this a correct conversion?
>
> We used to prepare the command line and called run_command() and
> without dying returned status with the error status from the
> merge-recursive that was spawned by run_command().
>
> The new code does not report failure to the caller and instead dies.True, this is incorrect.
I took a step back and realized that the most appropriate course of action would be to revert the commit that calls run_command() to begin with. This also solves the authorship issue.
And while at it, I also noticed another sore to my eye that I had noticed repeatedly and now fix as part of this patch series.
Thanks, Dscho