git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 3/3] rebase: use peel_committish() where appropriate
Date: Fri, 14 Jun 2013 09:56:57 -0700	[thread overview]
Message-ID: <7vmwqspr52.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1371215872-9796-4-git-send-email-artagnon@gmail.com> (Ramkumar Ramachandra's message of "Fri, 14 Jun 2013 18:47:52 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> The revisions specified on the command-line as <onto> and <upstream>
> arguments could be of the form :/quuxery; so, use peel_committish() to
> resolve them.  The failing tests in t/rebase and t/rebase-interactive
> now pass.

You can also specify the commit at the end of the history to be
rebased (very useful while trial runs to see where a series should
apply):

    git rebase foo ":/Add B"

This is already handled properly because it first gets turned into
an object name $orig_head and then we use it (without ^0) to update
the ORIG_HEAD.

Even after this patch, there is

	git checkout -q "$onto^0"

when detaching the HEAD to that commit.  Can that peeling be dropped
now (I am not suggesting to drop it in this patch)?

What would happen when you are given "--onto :/f...o" is somewhat
interesting, but that may be a separate topic, I think.  At that
point, it is probably in the realm of "don't do it then" ;-)

> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  git-rebase.sh                 | 4 ++--
>  t/t3400-rebase.sh             | 2 +-
>  t/t3404-rebase-interactive.sh | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/git-rebase.sh b/git-rebase.sh
> index d0c11a9..6987b9b 100755
> --- a/git-rebase.sh
> +++ b/git-rebase.sh
> @@ -434,7 +434,7 @@ then
>  		shift
>  		;;
>  	esac
> -	upstream=`git rev-parse --verify "${upstream_name}^0"` ||
> +	upstream=$(peel_committish "${upstream_name}") ||
>  	die "$(eval_gettext "invalid upstream \$upstream_name")"
>  	upstream_arg="$upstream_name"
>  else
> @@ -470,7 +470,7 @@ case "$onto_name" in
>  	fi
>  	;;
>  *)
> -	onto=$(git rev-parse --verify "${onto_name}^0") ||
> +	onto=$(peel_committish "$onto_name") ||
>  	die "$(eval_gettext "Does not point to a valid commit: \$onto_name")"
>  	;;
>  esac
> diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
> index 81ec517..cbca71e 100755
> --- a/t/t3400-rebase.sh
> +++ b/t/t3400-rebase.sh
> @@ -88,7 +88,7 @@ test_expect_success 'rebase fast-forward to master' '
>  	test_i18ngrep "Fast-forwarded HEAD to my-topic-branch" out
>  '
>  
> -test_expect_failure 'rebase, with <onto> and <upstream> specified as :/quuxery' '
> +test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '
>  	test_when_finished "git branch -D torebase" &&
>  	git checkout -b torebase my-topic-branch^ &&
>  	upstream=$(git rev-parse ":/Add B") &&
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> index eb241f5..86917d1 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -947,7 +947,7 @@ test_expect_success 'rebase -i respects core.commentchar' '
>  	test B = $(git cat-file commit HEAD^ | sed -ne \$p)
>  '
>  
> -test_expect_failure 'rebase -i, with <onto> and <upstream> specified as :/quuxery' '
> +test_expect_success 'rebase -i, with <onto> and <upstream> specified as :/quuxery' '
>  	test_when_finished "git branch -D torebase" &&
>  	git checkout -b torebase branch1 &&
>  	upstream=$(git rev-parse ":/J") &&

  reply	other threads:[~2013-06-14 16:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14 13:17 [PATCH 0/3] Get rebase to work with :/foomery committish Ramkumar Ramachandra
2013-06-14 13:17 ` [PATCH 1/3] t/rebase: add failing tests for a peculiar revision Ramkumar Ramachandra
2013-06-14 13:17 ` [PATCH 2/3] sh-setup: add new peel_committish() helper Ramkumar Ramachandra
2013-06-14 16:05   ` Philip Oakley
2013-06-14 16:18     ` Ramkumar Ramachandra
2013-06-14 16:44       ` Philip Oakley
2013-06-14 13:17 ` [PATCH 3/3] rebase: use peel_committish() where appropriate Ramkumar Ramachandra
2013-06-14 16:56   ` Junio C Hamano [this message]
2013-06-15 13:47     ` Ramkumar Ramachandra
2013-06-17  2:52       ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2013-06-13 18:15 [PATCH 0/3] Support :/quuxery in rebase (early preview) Ramkumar Ramachandra
2013-06-13 18:16 ` [PATCH 3/3] rebase: use peel_committish() where appropriate Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vmwqspr52.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).