From: Brian Gesiak <modocache@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Torsten Bögershausen" <tboegi@web.de>,
"Brian Gesiak" <modocache@gmail.com>
Subject: [PATCH v2] git-rebase: Teach rebase "-" shorthand.
Date: Wed, 19 Mar 2014 20:02:15 +0900 [thread overview]
Message-ID: <1395226935-53044-1-git-send-email-modocache@gmail.com> (raw)
In-Reply-To: <xmqq61nb8fap.fsf@gitster.dls.corp.google.com>
Teach rebase the same shorthand as checkout and merge; that is, that "-"
means "the branch we were previously on".
Reported-by: Tim Chase <git@tim.thechases.com>
Signed-off-by: Brian Gesiak <modocache@gmail.com>
---
git-rebase.sh | 4 ++++
t/t3400-rebase.sh | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/git-rebase.sh b/git-rebase.sh
index 5f6732b..2c75e9f 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -453,6 +453,10 @@ then
test "$fork_point" = auto && fork_point=t
;;
*) upstream_name="$1"
+ if test "$upstream_name" = "-"
+ then
+ upstream_name="@{-1}"
+ fi
shift
;;
esac
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 6d94b1f..6176754 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -88,6 +88,17 @@ test_expect_success 'rebase from ambiguous branch name' '
git rebase master
'
+test_expect_success 'rebase using shorthand' '
+ git checkout master &&
+ git checkout -b shorthand HEAD^ &&
+ git rebase - 1>shorthand.stdout &&
+ git checkout master &&
+ git branch -D shorthand &&
+ git checkout -b shorthand HEAD^ &&
+ git rebase @{-1} 1>without_shorthand.stdout &&
+ test_i18ncmp without_shorthand.stdout shorthand.stdout
+'
+
test_expect_success 'rebase a single mode change' '
git checkout master &&
git branch -D topic &&
--
1.8.5.2 (Apple Git-48)
next prev parent reply other threads:[~2014-03-19 11:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-18 8:44 [PATCH] git-rebase: Teach rebase "-" shorthand Brian Gesiak
2014-03-18 19:26 ` Torsten Bögershausen
2014-03-18 19:42 ` Junio C Hamano
2014-03-19 11:02 ` Brian Gesiak [this message]
2014-03-19 17:53 ` [PATCH v2] " Junio C Hamano
2014-03-19 18:02 ` John Keeping
2014-03-19 18:09 ` Brian Gesiak
2014-03-19 19:02 ` Junio C Hamano
2014-03-19 19:12 ` John Keeping
2014-03-19 19:41 ` Junio C Hamano
2014-03-19 19:55 ` John Keeping
2014-03-19 21:02 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395226935-53044-1-git-send-email-modocache@gmail.com \
--to=modocache@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tboegi@web.de \
/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.
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 NNTP newsgroup(s).