merge-base: handle --fork-point without reflog
commit4f21454b55f4237b7d0487ad5099c9edf4fc3967
authorJeff King <peff@peff.net>
Wed, 12 Oct 2016 20:10:40 +0000 (12 16:10 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Oct 2016 21:30:16 +0000 (12 14:30 -0700)
tree823ab289135da04b10f02367e2e73777e83cb54f
parent0b65a8dbdb38962e700ee16776a3042beb489060
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>
builtin/merge-base.c
t/t6010-merge-base.sh