Re: [PATCH 2/3] rebase: accept -<number> as another way of saying HEAD~<number>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 1, 2014 at 9:53 PM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> 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@xxxxxxxxx>
> ---
> 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 ...".

> +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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]