summaryrefslogtreecommitdiff
path: root/t/t6010-merge-base.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-10-12 20:10:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-10-12 21:30:16 (GMT)
commit4f21454b55f4237b7d0487ad5099c9edf4fc3967 (patch)
tree823ab289135da04b10f02367e2e73777e83cb54f /t/t6010-merge-base.sh
parent0b65a8dbdb38962e700ee16776a3042beb489060 (diff)
downloadgit-4f21454b55f4237b7d0487ad5099c9edf4fc3967.zip
git-4f21454b55f4237b7d0487ad5099c9edf4fc3967.tar.gz
git-4f21454b55f4237b7d0487ad5099c9edf4fc3967.tar.bz2
merge-base: handle --fork-point without reflog
The --fork-point option looks in the reflog to try to find where a derived branch forked from a base branch. However, if the reflog for the base branch is totally empty (as it commonly is right after cloning, which does not write a reflog entry), then our for_each_reflog call will not find any entries, and we will come up with no merge base, even though there may be one with the current tip of the base. We can fix this by just adding the current tip to our list of collected entries. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6010-merge-base.sh')
-rwxr-xr-xt/t6010-merge-base.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh
index 39b3238..de3bf07 100755
--- a/t/t6010-merge-base.sh
+++ b/t/t6010-merge-base.sh
@@ -258,6 +258,12 @@ test_expect_success 'using reflog to find the fork point' '
test_cmp expect3 actual
'
+test_expect_success '--fork-point works with empty reflog' '
+ git -c core.logallrefupdates=false branch no-reflog base &&
+ git merge-base --fork-point no-reflog derived &&
+ test_cmp expect3 actual
+'
+
test_expect_success 'merge-base --octopus --all for complex tree' '
# Best common ancestor for JE, JAA and JDD is JC
# JE