Re: [PATCH 11/11] builtin rebase: support `git rebase <upstream> <switch-to>`
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 8, 2018, 18:52 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1808082049180.71@tvgsbejvaqbjf.bet>
- In-Reply-To
- <CACsJy8BDLvGhRvNQgSgvkR-RMAvVxPpT=i9ayi=awQYOqd2Crg@mail.gmail.com>
Hi Duy,
On Wed, 8 Aug 2018, Duy Nguyen wrote:
Show 17 quoted lines
> On Wed, Aug 8, 2018 at 3:55 PM Pratik Karki <predatoramigo@gmail.com> wrote:
> >
> > diff --git a/builtin/rebase.c b/builtin/rebase.c
> > index 63634210c0..b2ddfa8dbf 100644
> > --- a/builtin/rebase.c
> > +++ b/builtin/rebase.c
> > @@ -585,7 +602,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
> > }
> > if (get_oid("HEAD", &options.orig_head))
> > die(_("Could not resolve HEAD to a revision"));
> > - }
> > + } else
> > + BUG("unexpected number of arguments left to parse");
>
> Does this mean "git base one two three" triggers this BUG? If so, this
> should be a die() instead. I did not real the full source code, so
> maybe this case is already caught higher up.As you can see from
https://github.com/git/git/blob/v2.18.0/git-rebase.sh#L615
the original, Unix shell script version of `git rebase` also says "BUG" here. And if you care to look at
https://github.com/git/git/blob/3358abdcb/builtin/rebase.c#L870-L872
you will see that there is a proper check for the correct amount of command-line parameters.
So at this point, it would indeed indicate a bug if the `argc` had an unexpected value.
Ciao, Dscho