Skip to content

Commit 5e72e71

Browse files
committed
Merge branch 'jk/pull-rebase-using-fork-point'
Finishing touches. * jk/pull-rebase-using-fork-point: rebase: fix fork-point with zero arguments
2 parents ca46578 + bb3f458 commit 5e72e71

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

git-rebase.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ esac
534534

535535
if test "$fork_point" = t
536536
then
537-
new_upstream=$(git merge-base --fork-point "$upstream_name" "$switch_to")
537+
new_upstream=$(git merge-base --fork-point "$upstream_name" \
538+
"${switch_to:-HEAD}")
538539
if test -n "$new_upstream"
539540
then
540541
upstream=$new_upstream

t/t3400-rebase.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,19 @@ test_expect_success 'fail when upstream arg is missing and not configured' '
135135
'
136136

137137
test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg' '
138+
git checkout -b default-base master &&
138139
git checkout -b default topic &&
139140
git config branch.default.remote . &&
140-
git config branch.default.merge refs/heads/master &&
141+
git config branch.default.merge refs/heads/default-base &&
141142
git rebase &&
142-
git rev-parse --verify master >expect &&
143+
git rev-parse --verify default-base >expect &&
144+
git rev-parse default~1 >actual &&
145+
test_cmp expect actual &&
146+
git checkout default-base &&
147+
git reset --hard HEAD^ &&
148+
git checkout default &&
149+
git rebase &&
150+
git rev-parse --verify default-base >expect &&
143151
git rev-parse default~1 >actual &&
144152
test_cmp expect actual
145153
'

0 commit comments

Comments
 (0)