Skip to content

Add merge-base fixtures#13

Merged
mcuadros merged 1 commit intosrc-d:masterfrom
dpordomingo:merge-base
Mar 28, 2019
Merged

Add merge-base fixtures#13
mcuadros merged 1 commit intosrc-d:masterfrom
dpordomingo:merge-base

Conversation

@dpordomingo
Copy link
Contributor

blocks src-d/go-git#1097


The following tests consider this history having two root commits: V and W

V---o---M----AB----A---CD1--R---C--------S-------------------Q < master
               \         \ /            /                   /
                \         X            GQ1---G < feature   /
                 \       / \          /     /             /
W---o---N----o----B---CD2---o---D----o----GQ2------------o < dev

MergeBase
----------------------------
passed  merge-base
 M, N               Commits with unrelated history, have no merge-base
 A, B    AB         Regular merge-base between two commits
 A, A    A          The merge-commit between equal commits, is the same
 Q, N    N          The merge-commit between a commit an its ancestor, is the ancestor
 C, D    CD1, CD2   Cross merges causes more than one merge-base
 G, Q    GQ1, GQ2   Feature branches including merges, causes more than one merge-base

Independents
----------------------------
candidates        result
 A                 A           Only one commit returns it
 A, A, A           A           Repeated commits are ignored
 A, A, M, M, N     A, N        M is reachable from A, no it is not independent
 CD1, CD2, M, N    CD1, CD2    M and N are reachable from CD2, so they're not
 C, G, dev, M, N   C, G, dev   M and N are reachable from G, so they're not
 A, A^, A, N, N^   A, N        A^ and N^ are rechable from A and N


IsAncestor
----------------------------
passed   result
 A^^, A   true      Will be true if first is ancestor of the second
 M, G     true      True because it will also reach G from M crossing merge commits
 A, A     true      True if first and second are the same
 M, N     false     Commits with unrelated history, will return false

Signed-off-by: David Pordomingo <David.Pordomingo.F@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants