diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-10-28 18:01:17 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-28 18:01:17 +0200 |
commit | 96ec83ce5207be0aac3c1df1ac92356f9de9ad81 (patch) | |
tree | 2fd2924a0023333772153f04fe654fbd8641e5b3 | |
parent | Merge branch 'dk/worktree-dup-checkout-with-bare-is-ok' into maint (diff) | |
parent | merge-base: handle --fork-point without reflog (diff) | |
download | git-96ec83ce5207be0aac3c1df1ac92356f9de9ad81.tar.xz git-96ec83ce5207be0aac3c1df1ac92356f9de9ad81.zip |
Merge branch 'jk/merge-base-fork-point-without-reflog' into maint
"git rebase" immediately after "git clone" failed to find the fork
point from the upstream.
* jk/merge-base-fork-point-without-reflog:
merge-base: handle --fork-point without reflog
-rw-r--r-- | builtin/merge-base.c | 3 | ||||
-rwxr-xr-x | t/t6010-merge-base.sh | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/builtin/merge-base.c b/builtin/merge-base.c index c0d1822eb3..b572a37c26 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -173,6 +173,9 @@ static int handle_fork_point(int argc, const char **argv) revs.initial = 1; for_each_reflog_ent(refname, collect_one_reflog_ent, &revs); + if (!revs.nr && !get_sha1(refname, sha1)) + add_one_commit(sha1, &revs); + for (i = 0; i < revs.nr; i++) revs.commit[i]->object.flags &= ~TMP_MARK; diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh index e0c5f44cac..31db7b5f91 100755 --- a/t/t6010-merge-base.sh +++ b/t/t6010-merge-base.sh @@ -260,6 +260,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 |