aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-28 13:51:20 -0700
committerJunio C Hamano <gitster@pobox.com>2014-03-28 13:51:20 -0700
commit97345145ff33286af6c14260432f5edfb56fdc82 (patch)
tree61d807db9d40a6582f39f258d688ce2bd9d2f90b
parent9abf65d23ce8700c290fa4f7d834a10ec5b3e327 (diff)
parent4f4074077fb0c3a2facc61b333337d024aeeebbf (diff)
downloadgit-97345145ff33286af6c14260432f5edfb56fdc82.tar.gz
Merge branch 'bg/rebase-off-of-previous-branch'
* bg/rebase-off-of-previous-branch: rebase: allow "-" short-hand for the previous branch
-rwxr-xr-xgit-rebase.sh4
-rwxr-xr-xt/t3400-rebase.sh17
2 files changed, 21 insertions, 0 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index 5f6732bf3d..2c75e9fa0f 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 6d94b1fcd9..80e0a951ea 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -88,6 +88,23 @@ test_expect_success 'rebase from ambiguous branch name' '
git rebase master
'
+test_expect_success 'rebase off of the previous branch using "-"' '
+ git checkout master &&
+ git checkout HEAD^ &&
+ git rebase @{-1} >expect.messages &&
+ git merge-base master HEAD >expect.forkpoint &&
+
+ git checkout master &&
+ git checkout HEAD^ &&
+ git rebase - >actual.messages &&
+ git merge-base master HEAD >actual.forkpoint &&
+
+ test_cmp expect.forkpoint actual.forkpoint &&
+ # the next one is dubious---we may want to say "-",
+ # instead of @{-1}, in the message
+ test_i18ncmp expect.messages actual.messages
+'
+
test_expect_success 'rebase a single mode change' '
git checkout master &&
git branch -D topic &&