rebase: find orig_head unambiguously
commitea709800302ecae8c2fbb03af01e36b7f9b4d042
authorPhil Hord <hordp@cisco.com>
Tue, 23 Apr 2013 22:51:14 +0000 (23 18:51 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 Apr 2013 23:29:07 +0000 (23 16:29 -0700)
tree363a4ec5029979224e8c282612b4a2215f3829e0
parent7e2010537e96d0a1144520222f20ba1dc3d61441
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>
git-rebase.sh
t/t3400-rebase.sh