#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # global test_description := ''Merge base and parent list computation. '' source ./test-lib.sh global M := '1130000000' global Z := '+0000' global GIT_COMMITTER_EMAIL := 'git@comm.iter.xz' global GIT_COMMITTER_NAME := ''C O Mmiter'' global GIT_AUTHOR_NAME := ''A U Thor'' global GIT_AUTHOR_EMAIL := 'git@au.thor.xz' export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL proc doit { global OFFSET := $1 && global NAME := $2 && shift 2 && global PARENTS := ''for P in @Argv { global PARENTS := ""$(PARENTS)-p $P "" } && global GIT_COMMITTER_DATE := ""$($M + $OFFSET) $Z"" && global GIT_AUTHOR_DATE := $GIT_COMMITTER_DATE && export GIT_COMMITTER_DATE GIT_AUTHOR_DATE && global commit := $[echo $NAME | git commit-tree $T $PARENTS] && echo $commit >.git/refs/tags/$NAME && echo $commit } test_expect_success 'setup' ' T=$(git mktree expected && MB=$(git merge-base G H) && git name-rev "$MB" >actual.single && MB=$(git merge-base --all G H) && git name-rev "$MB" >actual.all && MB=$(git show-branch --merge-base G H) && git name-rev "$MB" >actual.sb && test_cmp expected actual.single && test_cmp expected actual.all && test_cmp expected actual.sb ' test_expect_success 'merge-base/show-branch --independent' ' git name-rev "$H" >expected1 && git name-rev "$H" "$G" >expected2 && parents=$(git merge-base --independent H) && git name-rev $parents >actual1.mb && parents=$(git merge-base --independent A H G) && git name-rev $parents >actual2.mb && parents=$(git show-branch --independent H) && git name-rev $parents >actual1.sb && parents=$(git show-branch --independent A H G) && git name-rev $parents >actual2.sb && test_cmp expected1 actual1.mb && test_cmp expected2 actual2.mb && test_cmp expected1 actual1.sb && test_cmp expected2 actual2.sb ' test_expect_success 'unsynchronized clocks' ' # This test is to demonstrate that relying on timestamps in a distributed # SCM to provide a _consistent_ partial ordering of commits leads to # insanity. # # Relative # Structure timestamps # # PL PR +4 +4 # / \/ \ / \/ \ # L2 C2 R2 +3 -1 +3 # | | | | | | # L1 C1 R1 +2 -2 +2 # | | | | | | # L0 C0 R0 +1 -3 +1 # \ | / \ | / # S 0 # # The left and right chains of commits can be of any length and complexity as # long as all of the timestamps are greater than that of S. S=$(doit 0 S) && C0=$(doit -3 C0 $S) && C1=$(doit -2 C1 $C0) && C2=$(doit -1 C2 $C1) && L0=$(doit 1 L0 $S) && L1=$(doit 2 L1 $L0) && L2=$(doit 3 L2 $L1) && R0=$(doit 1 R0 $S) && R1=$(doit 2 R1 $R0) && R2=$(doit 3 R2 $R1) && PL=$(doit 4 PL $L2 $C2) && PR=$(doit 4 PR $C2 $R2) && git name-rev $C2 >expected && MB=$(git merge-base PL PR) && git name-rev "$MB" >actual.single && MB=$(git merge-base --all PL PR) && git name-rev "$MB" >actual.all && test_cmp expected actual.single && test_cmp expected actual.all ' test_expect_success '--independent with unsynchronized clocks' ' IB=$(doit 0 IB) && I1=$(doit -10 I1 $IB) && I2=$(doit -9 I2 $I1) && I3=$(doit -8 I3 $I2) && I4=$(doit -7 I4 $I3) && I5=$(doit -6 I5 $I4) && I6=$(doit -5 I6 $I5) && I7=$(doit -4 I7 $I6) && I8=$(doit -3 I8 $I7) && IH=$(doit -2 IH $I8) && echo $IH >expected && git merge-base --independent IB IH >actual && test_cmp expected actual ' test_expect_success 'merge-base for octopus-step (setup)' ' # Another set to demonstrate base between one commit and a merge # in the documentation. # # * C (MMC) * B (MMB) * A (MMA) # * o * o * o # * o * o * o # * o * o * o # * o | _______/ # | |/ # | * 1 (MM1) # | _______/ # |/ # * root (MMR) test_commit MMR && test_commit MM1 && test_commit MM-o && test_commit MM-p && test_commit MM-q && test_commit MMA && git checkout MM1 && test_commit MM-r && test_commit MM-s && test_commit MM-t && test_commit MMB && git checkout MMR && test_commit MM-u && test_commit MM-v && test_commit MM-w && test_commit MM-x && test_commit MMC ' test_expect_success 'merge-base A B C' ' git rev-parse --verify MM1 >expected && git rev-parse --verify MMR >expected.sb && git merge-base --all MMA MMB MMC >actual && git merge-base --all --octopus MMA MMB MMC >actual.common && git show-branch --merge-base MMA MMB MMC >actual.sb && test_cmp expected actual && test_cmp expected.sb actual.common && test_cmp expected.sb actual.sb ' test_expect_success 'criss-cross merge-base for octopus-step' ' git reset --hard MMR && test_commit CC1 && git reset --hard E && test_commit CC2 && test_tick && # E is a root commit unrelated to MMR root on which CC1 is based git merge -s ours --allow-unrelated-histories CC1 && test_commit CC-o && test_commit CCB && git reset --hard CC1 && # E is a root commit unrelated to MMR root on which CC1 is based git merge -s ours --allow-unrelated-histories CC2 && test_commit CCA && git rev-parse CC1 CC2 >expected && git merge-base --all CCB CCA^^ CCA^^2 >actual && sort expected >expected.sorted && sort actual >actual.sorted && test_cmp expected.sorted actual.sorted ' test_expect_success 'using reflog to find the fork point' ' git reset --hard && git checkout -b base $E && ( for count in 1 2 3 do git commit --allow-empty -m "Base commit #$count" && git rev-parse HEAD >expect$count && git checkout -B derived && git commit --allow-empty -m "Derived #$count" && git rev-parse HEAD >derived$count && git checkout -B base $E || exit 1 done for count in 1 2 3 do git merge-base --fork-point base $(cat derived$count) >actual && test_cmp expect$count actual || exit 1 done ) && # check that we correctly default to HEAD git checkout derived && git merge-base --fork-point base >actual && 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 # / | # / | # / | # JAA / | # |\ / | # | \ | JDD | # | \ |/ | | # | JC JD | # | | /| | # | |/ | | # JA | | | # |\ /| | | # X JB | X X # \ \ | / / # \__\|/___/ # J test_commit J && test_commit JB && git reset --hard J && test_commit JC && git reset --hard J && test_commit JTEMP1 && test_merge JA JB && test_merge JAA JC && git reset --hard J && test_commit JTEMP2 && test_merge JD JB && test_merge JDD JC && git reset --hard J && test_commit JTEMP3 && test_merge JE JC && git rev-parse JC >expected && git merge-base --all --octopus JAA JDD JE >actual && test_cmp expected actual ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Merge base and parent list computation.\n">)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:M) op:Equal rhs:{(1130000000)} spids:[24])] spids: [24] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:Z) op:Equal rhs:{(Lit_Other "+") (0000)} spids:[27])] spids: [27] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_COMMITTER_EMAIL) op: Equal rhs: {(git) (Lit_Other "@") (comm.iter.xz)} spids: [32] ) ] spids: [32] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_COMMITTER_NAME) op: Equal rhs: {(SQ <"C O Mmiter">)} spids: [37] ) ] spids: [37] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_AUTHOR_NAME) op: Equal rhs: {(SQ <"A U Thor">)} spids: [42] ) ] spids: [42] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_AUTHOR_EMAIL) op: Equal rhs: {(git) (Lit_Other "@") (au.thor.xz)} spids: [47] ) ] spids: [47] ) (C {(export)} {(GIT_COMMITTER_EMAIL)} {(GIT_COMMITTER_NAME)} {(GIT_AUTHOR_NAME)} {(GIT_AUTHOR_EMAIL)}) (FuncDef name: doit body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:OFFSET) op: Equal rhs: {($ VSub_Number "$1")} spids: [71] ) ] spids: [71] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NAME) op: Equal rhs: {($ VSub_Number "$2")} spids: [77] ) ] spids: [77] ) (AndOr children: [ (C {(shift)} {(2)}) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PARENTS) op: Equal rhs: {(SQ )} spids: [91] ) ] spids: [91] ) (AndOr children: [ (ForEach iter_name: P do_arg_iter: True body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PARENTS) op: Equal rhs: { (DQ (${ VSub_Name PARENTS) ("-p ") ($ VSub_Name "$P") (" ") ) } spids: [104] ) ] spids: [104] ) ] spids: [101 115] ) spids: [-1 -1] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_COMMITTER_DATE) op: Equal rhs: { (DQ (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$M")}) right: (ArithWord w:{($ VSub_Name "$OFFSET")}) ) spids: [123 130] ) (" ") ($ VSub_Name "$Z") ) } spids: [121] ) ] spids: [121] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_AUTHOR_DATE) op: Equal rhs: {($ VSub_Name "$GIT_COMMITTER_DATE")} spids: [138] ) ] spids: [138] ) (AndOr children: [ (C {(export)} {(GIT_COMMITTER_DATE)} {(GIT_AUTHOR_DATE)}) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:commit) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$NAME")} ) (C {(git)} {(commit-tree)} {($ VSub_Name "$T")} {($ VSub_Name "$PARENTS")} ) ] negated: False ) ] ) left_token: spids: [155 169] ) } spids: [154] ) ] spids: [154] ) (AndOr children: [ (SimpleCommand words: [{(echo)} {($ VSub_Name "$commit")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(.git/refs/tags/) ($ VSub_Name "$NAME")} spids: [179] ) ] ) (C {(echo)} {($ VSub_Name "$commit")}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [68] ) spids: [63 67] ) (C {(test_expect_success)} {(SQ )} {(SQ <"\n"> <"\tT=$(git mktree )}) (C {(test_expect_success)} {(SQ <"set up G and H">)} { (SQ <"\n"> <"\t# E---D---C---B---A\n"> <"\t# \\\"-_ \\ \\\n"> <"\t# \\ `---------G \\\n"> <"\t# \\ \\\n"> <"\t# F----------------H\n"> <"\tE=$(doit 5 E) &&\n"> <"\tD=$(doit 4 D $E) &&\n"> <"\tF=$(doit 6 F $E) &&\n"> <"\tC=$(doit 3 C $D) &&\n"> <"\tB=$(doit 2 B $C) &&\n"> <"\tA=$(doit 1 A $B) &&\n"> <"\tG=$(doit 7 G $B $E) &&\n"> <"\tH=$(doit 8 H $A $F)\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge-base G H">)} { (SQ <"\n"> <"\tgit name-rev $B >expected &&\n"> <"\n"> <"\tMB=$(git merge-base G H) &&\n"> <"\tgit name-rev \"$MB\" >actual.single &&\n"> <"\n"> <"\tMB=$(git merge-base --all G H) &&\n"> <"\tgit name-rev \"$MB\" >actual.all &&\n"> <"\n"> <"\tMB=$(git show-branch --merge-base G H) &&\n"> <"\tgit name-rev \"$MB\" >actual.sb &&\n"> <"\n"> <"\ttest_cmp expected actual.single &&\n"> <"\ttest_cmp expected actual.all &&\n"> <"\ttest_cmp expected actual.sb\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge-base/show-branch --independent">)} { (SQ <"\n"> <"\tgit name-rev \"$H\" >expected1 &&\n"> <"\tgit name-rev \"$H\" \"$G\" >expected2 &&\n"> <"\n"> <"\tparents=$(git merge-base --independent H) &&\n"> <"\tgit name-rev $parents >actual1.mb &&\n"> <"\tparents=$(git merge-base --independent A H G) &&\n"> <"\tgit name-rev $parents >actual2.mb &&\n"> <"\n"> <"\tparents=$(git show-branch --independent H) &&\n"> <"\tgit name-rev $parents >actual1.sb &&\n"> <"\tparents=$(git show-branch --independent A H G) &&\n"> <"\tgit name-rev $parents >actual2.sb &&\n"> <"\n"> <"\ttest_cmp expected1 actual1.mb &&\n"> <"\ttest_cmp expected2 actual2.mb &&\n"> <"\ttest_cmp expected1 actual1.sb &&\n"> <"\ttest_cmp expected2 actual2.sb\n"> ) } ) (C {(test_expect_success)} {(SQ <"unsynchronized clocks">)} { (SQ <"\n"> <"\t# This test is to demonstrate that relying on timestamps in a distributed\n"> <"\t# SCM to provide a _consistent_ partial ordering of commits leads to\n"> <"\t# insanity.\n"> <"\t#\n"> <"\t# Relative\n"> <"\t# Structure timestamps\n"> <"\t#\n"> <"\t# PL PR +4 +4\n"> <"\t# / \\/ \\ / \\/ \\\n"> <"\t# L2 C2 R2 +3 -1 +3\n"> <"\t# | | | | | |\n"> <"\t# L1 C1 R1 +2 -2 +2\n"> <"\t# | | | | | |\n"> <"\t# L0 C0 R0 +1 -3 +1\n"> <"\t# \\ | / \\ | /\n"> <"\t# S 0\n"> <"\t#\n"> <"\t# The left and right chains of commits can be of any length and complexity as\n"> <"\t# long as all of the timestamps are greater than that of S.\n"> <"\n"> <"\tS=$(doit 0 S) &&\n"> <"\n"> <"\tC0=$(doit -3 C0 $S) &&\n"> <"\tC1=$(doit -2 C1 $C0) &&\n"> <"\tC2=$(doit -1 C2 $C1) &&\n"> <"\n"> <"\tL0=$(doit 1 L0 $S) &&\n"> <"\tL1=$(doit 2 L1 $L0) &&\n"> <"\tL2=$(doit 3 L2 $L1) &&\n"> <"\n"> <"\tR0=$(doit 1 R0 $S) &&\n"> <"\tR1=$(doit 2 R1 $R0) &&\n"> <"\tR2=$(doit 3 R2 $R1) &&\n"> <"\n"> <"\tPL=$(doit 4 PL $L2 $C2) &&\n"> <"\tPR=$(doit 4 PR $C2 $R2) &&\n"> <"\n"> <"\tgit name-rev $C2 >expected &&\n"> <"\n"> <"\tMB=$(git merge-base PL PR) &&\n"> <"\tgit name-rev \"$MB\" >actual.single &&\n"> <"\n"> <"\tMB=$(git merge-base --all PL PR) &&\n"> <"\tgit name-rev \"$MB\" >actual.all &&\n"> <"\n"> <"\ttest_cmp expected actual.single &&\n"> <"\ttest_cmp expected actual.all\n"> ) } ) (C {(test_expect_success)} {(SQ <"--independent with unsynchronized clocks">)} { (SQ <"\n"> <"\tIB=$(doit 0 IB) &&\n"> <"\tI1=$(doit -10 I1 $IB) &&\n"> <"\tI2=$(doit -9 I2 $I1) &&\n"> <"\tI3=$(doit -8 I3 $I2) &&\n"> <"\tI4=$(doit -7 I4 $I3) &&\n"> <"\tI5=$(doit -6 I5 $I4) &&\n"> <"\tI6=$(doit -5 I6 $I5) &&\n"> <"\tI7=$(doit -4 I7 $I6) &&\n"> <"\tI8=$(doit -3 I8 $I7) &&\n"> <"\tIH=$(doit -2 IH $I8) &&\n"> <"\n"> <"\techo $IH >expected &&\n"> <"\tgit merge-base --independent IB IH >actual &&\n"> <"\ttest_cmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge-base for octopus-step (setup)">)} { (SQ <"\n"> <"\t# Another set to demonstrate base between one commit and a merge\n"> <"\t# in the documentation.\n"> <"\t#\n"> <"\t# * C (MMC) * B (MMB) * A (MMA)\n"> <"\t# * o * o * o\n"> <"\t# * o * o * o\n"> <"\t# * o * o * o\n"> <"\t# * o | _______/\n"> <"\t# | |/\n"> <"\t# | * 1 (MM1)\n"> <"\t# | _______/\n"> <"\t# |/\n"> <"\t# * root (MMR)\n"> <"\n"> <"\ttest_commit MMR &&\n"> <"\ttest_commit MM1 &&\n"> <"\ttest_commit MM-o &&\n"> <"\ttest_commit MM-p &&\n"> <"\ttest_commit MM-q &&\n"> <"\ttest_commit MMA &&\n"> <"\tgit checkout MM1 &&\n"> <"\ttest_commit MM-r &&\n"> <"\ttest_commit MM-s &&\n"> <"\ttest_commit MM-t &&\n"> <"\ttest_commit MMB &&\n"> <"\tgit checkout MMR &&\n"> <"\ttest_commit MM-u &&\n"> <"\ttest_commit MM-v &&\n"> <"\ttest_commit MM-w &&\n"> <"\ttest_commit MM-x &&\n"> <"\ttest_commit MMC\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge-base A B C">)} { (SQ <"\n"> <"\tgit rev-parse --verify MM1 >expected &&\n"> <"\tgit rev-parse --verify MMR >expected.sb &&\n"> <"\n"> <"\tgit merge-base --all MMA MMB MMC >actual &&\n"> <"\tgit merge-base --all --octopus MMA MMB MMC >actual.common &&\n"> <"\tgit show-branch --merge-base MMA MMB MMC >actual.sb &&\n"> <"\n"> <"\ttest_cmp expected actual &&\n"> <"\ttest_cmp expected.sb actual.common &&\n"> <"\ttest_cmp expected.sb actual.sb\n"> ) } ) (C {(test_expect_success)} {(SQ <"criss-cross merge-base for octopus-step">)} { (SQ <"\n"> <"\tgit reset --hard MMR &&\n"> <"\ttest_commit CC1 &&\n"> <"\tgit reset --hard E &&\n"> <"\ttest_commit CC2 &&\n"> <"\ttest_tick &&\n"> <"\t# E is a root commit unrelated to MMR root on which CC1 is based\n"> <"\tgit merge -s ours --allow-unrelated-histories CC1 &&\n"> <"\ttest_commit CC-o &&\n"> <"\ttest_commit CCB &&\n"> <"\tgit reset --hard CC1 &&\n"> <"\t# E is a root commit unrelated to MMR root on which CC1 is based\n"> <"\tgit merge -s ours --allow-unrelated-histories CC2 &&\n"> <"\ttest_commit CCA &&\n"> <"\n"> <"\tgit rev-parse CC1 CC2 >expected &&\n"> <"\tgit merge-base --all CCB CCA^^ CCA^^2 >actual &&\n"> <"\n"> <"\tsort expected >expected.sorted &&\n"> <"\tsort actual >actual.sorted &&\n"> <"\ttest_cmp expected.sorted actual.sorted\n"> ) } ) (C {(test_expect_success)} {(SQ <"using reflog to find the fork point">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout -b base $E &&\n"> <"\n"> <"\t(\n"> <"\t\tfor count in 1 2 3\n"> <"\t\tdo\n"> <"\t\t\tgit commit --allow-empty -m \"Base commit #$count\" &&\n"> <"\t\t\tgit rev-parse HEAD >expect$count &&\n"> <"\t\t\tgit checkout -B derived &&\n"> <"\t\t\tgit commit --allow-empty -m \"Derived #$count\" &&\n"> <"\t\t\tgit rev-parse HEAD >derived$count &&\n"> <"\t\t\tgit checkout -B base $E || exit 1\n"> <"\t\tdone\n"> <"\n"> <"\t\tfor count in 1 2 3\n"> <"\t\tdo\n"> <"\t\t\tgit merge-base --fork-point base $(cat derived$count) >actual &&\n"> <"\t\t\ttest_cmp expect$count actual || exit 1\n"> <"\t\tdone\n"> <"\n"> <"\t) &&\n"> <"\t# check that we correctly default to HEAD\n"> <"\tgit checkout derived &&\n"> <"\tgit merge-base --fork-point base >actual &&\n"> <"\ttest_cmp expect3 actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--fork-point works with empty reflog">)} { (SQ <"\n"> <"\tgit -c core.logallrefupdates=false branch no-reflog base &&\n"> <"\tgit merge-base --fork-point no-reflog derived &&\n"> <"\ttest_cmp expect3 actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge-base --octopus --all for complex tree">)} { (SQ <"\n"> <"\t# Best common ancestor for JE, JAA and JDD is JC\n"> <"\t# JE\n"> <"\t# / |\n"> <"\t# / |\n"> <"\t# / |\n"> <"\t# JAA / |\n"> <"\t# |\\ / |\n"> <"\t# | \\ | JDD |\n"> <"\t# | \\ |/ | |\n"> <"\t# | JC JD |\n"> <"\t# | | /| |\n"> <"\t# | |/ | |\n"> <"\t# JA | | |\n"> <"\t# |\\ /| | |\n"> <"\t# X JB | X X\n"> <"\t# \\ \\ | / /\n"> <"\t# \\__\\|/___/\n"> <"\t# J\n"> <"\ttest_commit J &&\n"> <"\ttest_commit JB &&\n"> <"\tgit reset --hard J &&\n"> <"\ttest_commit JC &&\n"> <"\tgit reset --hard J &&\n"> <"\ttest_commit JTEMP1 &&\n"> <"\ttest_merge JA JB &&\n"> <"\ttest_merge JAA JC &&\n"> <"\tgit reset --hard J &&\n"> <"\ttest_commit JTEMP2 &&\n"> <"\ttest_merge JD JB &&\n"> <"\ttest_merge JDD JC &&\n"> <"\tgit reset --hard J &&\n"> <"\ttest_commit JTEMP3 &&\n"> <"\ttest_merge JE JC &&\n"> <"\tgit rev-parse JC >expected &&\n"> <"\tgit merge-base --all --octopus JAA JDD JE >actual &&\n"> <"\ttest_cmp expected actual\n"> ) } ) (C {(test_done)}) ] )