summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPhil Hord <hordp@cisco.com>2013-04-23 22:51:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-23 23:29:07 (GMT)
commitea709800302ecae8c2fbb03af01e36b7f9b4d042 (patch)
tree363a4ec5029979224e8c282612b4a2215f3829e0 /t
parent7e2010537e96d0a1144520222f20ba1dc3d61441 (diff)
downloadgit-ea709800302ecae8c2fbb03af01e36b7f9b4d042.zip
git-ea709800302ecae8c2fbb03af01e36b7f9b4d042.tar.gz
git-ea709800302ecae8c2fbb03af01e36b7f9b4d042.tar.bz2
rebase: find orig_head unambiguously
When we 'git rebase $upstream', git uses 'rev-parse --verify $current_branch' to find ORIG_HEAD. But if $current_branch is ambiguous, 'rev-parse --verify' emits a warning and returns a SHA1 anyway. When the wrong ambiguous choice is used, git-rebase fails non-gracefully: it emits a warning about failing to lock $current_branch, an error about being unable to checkout $current_branch again, and it might even decide the rebase is a fast-forward when it is not. In the 'rebase $upstream' case, we already know the unambiguous spelling of $current_branch is "HEAD". Fix git-rebase to find $orig_head unambiguously. Add a test in t3400-rebase.sh which creates an ambiguous branch name and rebases it implicitly with 'git rebase $other'. Signed-off-by: Phil Hord <hordp@cisco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t3400-rebase.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 1de0ebd..e6af021 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -101,7 +101,14 @@ test_expect_success 'HEAD was detached during rebase' '
test $(git rev-parse HEAD@{1}) != $(git rev-parse my-topic-branch@{1})
'
+test_expect_success 'rebase from ambiguous branch name' '
+ git checkout -b topic side &&
+ git rebase master
+'
+
test_expect_success 'rebase after merge master' '
+ git checkout --detach refs/tags/topic &&
+ git branch -D topic &&
git reset --hard topic &&
git merge master &&
git rebase master &&