Re: [PATCH 4/5] add -p: avoid ambiguous signed/unsigned comparison
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 16, 2022, 10:00 UTC
- Message-ID
- <p1nn7o5q-9r34-n27o-s8r6-50277p3rp604@tzk.qr>
- In-Reply-To
- <ec8204d5-9d0d-9850-f930-6fc1a8efacc5@gmail.com>
Hi Phillip,
On Thu, 11 Aug 2022, Phillip Wood wrote:
Show 11 quoted lines
> On 10/08/2022 16:02, Johannes Schindelin via GitGitGadget wrote: > > > diff --git a/add-patch.c b/add-patch.c > > index 509ca04456b..3524555e2b0 100644 > > --- a/add-patch.c > > +++ b/add-patch.c > > @@ -1547,7 +1547,7 @@ soft_increment: > > strbuf_remove(&s->answer, 0, 1); > > strbuf_trim(&s->answer); > > Unrelated to this change but why don't we just call strbuf_reset() here?
This part of the code is used when the `g` command (to "go to hunk") was issued by the user. And that `g` command allows for a number to be specified, e.g. `g1` to go to the first hunk.
The `strbuf_remove(&s->answer, 0, 1)` removes the `g` from the command.
The `strbuf_trim(&s->answer)` allows for whitespace between the `g` and the number, e.g. `g 1` should also go to the first hunk.
If we called `strbuf_reset()` here, we would remove the number completely.
Ciao, Dscho