Re: [PATCH v2 05/34] sequencer (rebase -i): learn about the 'verbose' mode
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 7, 2017, 21:48 UTC
- Message-ID
- <xmqqk2a635it.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <alpine.DEB.2.20.1701021610590.3469@virtualbox>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 36 quoted lines
> Hi Junio,
>
> On Tue, 13 Dec 2016, Junio C Hamano wrote:
>
>> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
>>
>> > @@ -1493,9 +1498,26 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
>> > }
>> >
>> > if (is_rebase_i(opts)) {
>> > + struct strbuf buf = STRBUF_INIT;
>> > +
>> > /* Stopped in the middle, as planned? */
>> > if (todo_list->current < todo_list->nr)
>> > return 0;
>> > +
>> > + if (opts->verbose) {
>> > + const char *argv[] = {
>> > + "diff-tree", "--stat", NULL, NULL
>> > + };
>> > +
>> > + if (!read_oneliner(&buf, rebase_path_orig_head(), 0))
>> > + return error(_("could not read '%s'"),
>> > + rebase_path_orig_head());
>> > + strbuf_addstr(&buf, "..HEAD");
>> > + argv[2] = buf.buf;
>> > + run_command_v_opt(argv, RUN_GIT_CMD);
>> > + strbuf_reset(&buf);
>> > + }
>> > + strbuf_release(&buf);
>> > }
>>
>> It's a bit curious that the previous step avoided running a separate
>> process and instead did "diff-tree -p" all in C, but this one does not.
>
> I guess my only defence is that I tried to be a little lazy.I actually was alluding to going the other way around, spawning "diff-tree -p" in the other codepath like this one does.