Skip to content

Rejecting useless merge bases

Junio C Hamano git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7commit: simplify fastpath of merge-base computationcommit.c+11 -40 replies
2/7sha1_name: remove ONELINE_SEEN bitobject.h sha1_name.c+4 -70 replies
3/7merge-base: stop moving commits around in remove_redundant()commit.c+18 -140 replies
4/7merge-base: expose get_merge_bases_many_0() a bit morecommit.c commit.h+10 -150 replies
5/7merge-base: mark bases that are on first-parent chaincommit.c commit.h object.h+17 -31 reply
6/7merge-base: limit the output to bases that are on first-parent chainDocumentation/git-merge-base.txt builtin/merge-base.c+14 -40 replies
7/7merge: allow to use only the fp-only merge basesDocumentation/merge-options.txt builtin/merge.c+21 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/7] Rejecting useless merge bases

This is a continuation of

http://public-inbox.org/git/[email protected]

In a workflow where topic branches are first merged to the 'next' integration branch to be tested before getting merged down to the 'master' integration branch to be consumed by the end users, merging the 'master' branch back to the 'next' happens after topics graduate to 'master' and release notes entries are written for them.

Git finds many merge bases between 'master' and 'next' while creating this merge. In addition to the tip of 'master' back when we made such a merge back from 'master' to 'next' was made the last time, which is the most reasonable merge base to explain the histories of both branches, all the tips of topic branches that graduated recently are merge bases. Because these tips of topic branches were already in 'next', the tip of 'next' reaches them, and because they just graduated to 'master', the tip of 'master' reaches them, too. And these topics are independent most of the time (that is the point of employing the topic-branch workflow), so they cannot be reduced.

The merge-recursive machinery is very inefficient to compute this merge, because it needs to create pointless virtual merge-base commits across these many merge bases. Conceptually, the point where the histories of 'master' and 'next' diverged was the tip of 'master' back when we created such a merge back from 'master' to 'next' the last time, and in practice that is the only merge base that matters.

The series allows us to ignore these tips of topics, which are uninteresting merge bases, when running "git merge". The example merge with 12 merge bases:

    git checkout 4868def05e && git merge 659889482a

in our history takes about 1.22-1.33 seconds without the series, while running the latter "git merge" with the "--fp-base-only" option takes about 0.54-0.59 seconds.

Junio C Hamano (7):
commit: simplify fastpath of merge-base
sha1_name: remove ONELINE_SEEN bit
merge-base: stop moving commits around in remove_redundant()
merge-base: expose get_merge_bases_many_0() a bit more
merge-base: mark bases that are on first-parent chain
merge-base: limit the output to bases that are on first-parent chain
merge: allow to use only the fp-only merge bases

 Documentation/git-merge-base.txt |  8 +++-
 Documentation/merge-options.txt  |  9 +++++
 builtin/merge-base.c             | 10 +++--
 builtin/merge.c                  | 15 ++++++--
 commit.c                         | 81 ++++++++++++++++++++++++----------------
 commit.h                         |  7 +++-
 object.h                         |  3 +-
 sha1_name.c                      | 10 ++---
 8 files changed, 94 insertions(+), 49 deletions(-)
Signature · 1 line
2.10.1-631-gb2c64dcf30