Skip to content

Commit d1ab718

Browse files
committed
Merge branch 'ph/rebase-original'
* ph/rebase-original: rebase: find orig_head unambiguously
2 parents 019eb0d + ea70980 commit d1ab718

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

git-rebase.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ case "$#" in
473473
head_name="detached HEAD"
474474
branch_name=HEAD ;# detached
475475
fi
476-
orig_head=$(git rev-parse --verify "${branch_name}^0") || exit
476+
orig_head=$(git rev-parse --verify HEAD) || exit
477477
;;
478478
*)
479479
die "BUG: unexpected number of arguments left to parse"

t/t3400-rebase.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ test_expect_success 'HEAD was detached during rebase' '
101101
test $(git rev-parse HEAD@{1}) != $(git rev-parse my-topic-branch@{1})
102102
'
103103

104+
test_expect_success 'rebase from ambiguous branch name' '
105+
git checkout -b topic side &&
106+
git rebase master
107+
'
108+
104109
test_expect_success 'rebase after merge master' '
110+
git checkout --detach refs/tags/topic &&
111+
git branch -D topic &&
105112
git reset --hard topic &&
106113
git merge master &&
107114
git rebase master &&

0 commit comments

Comments
 (0)