Re: [PATCH 2/3] rebase: accept -<number> as another way of saying HEAD~<number>
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 2, 2014, 08:37 UTC
- Message-ID
- <CAPig+cTj1hBOFDLA5LecXwrVN4FG6pAzSDTAyLchHQbOkoEnEA@mail.gmail.com>
- In-Reply-To
- <1393728794-29566-3-git-send-email-pclouds@gmail.com>
On Sat, Mar 1, 2014 at 9:53 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 16 quoted lines
> This is "rev-list style", where people can do "git rev-list -3" in > addition to "git rev-list HEAD~3". A lot of commands are driven by the > revision machinery and also accept this form. This addition to rebase > is just for convenience. > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> > --- > diff --git a/git-rebase.sh b/git-rebase.sh > index 5f6732b..33face1 100755 > --- a/git-rebase.sh > +++ b/git-rebase.sh > @@ -342,6 +346,11 @@ do > esac > shift > done > +if [ -n "$NUM" ]
With the exception of one errant "if [...]", git-rebase.sh uniformly uses "if test ...".
Show 24 quoted lines
> +then > + test $# -gt 0 && usage > + set -- "$@" "HEAD~$NUM" > +fi > test $# -gt 2 && usage > > if test -n "$cmd" && > diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh > index 6d94b1f..11db7ea 100755 > --- a/t/t3400-rebase.sh > +++ b/t/t3400-rebase.sh > @@ -215,4 +215,10 @@ test_expect_success 'rebase commit with an ancient timestamp' ' > grep "author .* 34567 +0600$" actual > ' > > +test_expect_success 'rebase -<number>' ' > + git reset --hard && > + test_must_fail git rebase -2 HEAD^^ && > + git rebase -2 > +' > + > test_done > -- > 1.9.0.40.gaa8c3ea