Re: [PATCH v4 10/10] rebase -i: rearrange fixup/squash lines using the rebase--helper
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 29, 2017, 11:26 UTC
- Message-ID
- <alpine.DEB.2.21.1.1705291322150.3610@virtualbox>
- In-Reply-To
- <20170526031639.10790-1-liambeguin@gmail.com>
Hi Liam,
On Thu, 25 May 2017, Liam Beguin wrote:
Show 27 quoted lines
> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> [...]
> > + if (rearranged) {
> > + struct strbuf buf = STRBUF_INIT;
> > +
> > + for (i = 0; i < todo_list.nr; i++) {
> > + enum todo_command command = todo_list.items[i].command;
> > + int cur = i;
> > +
> > + /*
> > + * Initially, all commands are 'pick's. If it is a
> > + * fixup or a squash now, we have rearranged it.
> > + */
> > + if (is_fixup(command))
> > + continue;
> > +
> > + while (cur >= 0) {
> > + int offset = todo_list.items[cur].offset_in_buf;
> > + int end_offset = cur + 1 < todo_list.nr ?
> > + todo_list.items[cur + 1].offset_in_buf :
> > + todo_list.buf.len;
> > + char *bol = todo_list.buf.buf + offset;
> > + char *eol = todo_list.buf.buf + end_offset;
>
> I got a little confused with these offsets. I know it was part of a
> previous series, but maybe we could add a description to the fields
> of `struct todo_list` and `struct todo_item`.You mean "offset_in_buf"?
Sure, I can add a comment there. I would like to keep it out of this patch series, though, as the purpose of it is to accelerate rebase -i by moving logic from the (slow) shell script code to the (decently fast) C code.
Ciao, Johannes