(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'merge simplification'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: note body: (BraceGroup children:[(C {<git>} {<tag>} {(DQ ($ Id.VSub_Number '$1'))})]) ) (command.ShFunction name: unnote body: (BraceGroup children: [ (command.Pipeline children: [ (C {<git>} {<name-rev>} {<--tags>} {<--stdin>}) (C {<sed>} {<-e>} { (DQ <'s|'> ($ Id.VSub_DollarName '$_x40') <' (tags/'> <Id.Lit_Other '\\'> <'([^)]*'> <Id.Lit_Other '\\'> <')) |'> <Id.Lit_Other '\\'> <'1 |g'> ) } ) ] negated: F ) ] ) ) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\techo "Hi there" >file &&\n'> <'\techo "initial" >lost &&\n'> <'\tgit add file lost &&\n'> <'\ttest_tick && git commit -m "Initial file and lost" &&\n'> <'\tnote A &&\n'> <'\n'> <'\tgit branch other-branch &&\n'> <'\n'> <'\techo "Hello" >file &&\n'> <'\techo "second" >lost &&\n'> <'\tgit add file lost &&\n'> <'\ttest_tick && git commit -m "Modified file and lost" &&\n'> <'\tnote B &&\n'> <'\n'> <'\tgit checkout other-branch &&\n'> <'\n'> <'\techo "Hello" >file &&\n'> <'\t>lost &&\n'> <'\tgit add file lost &&\n'> <'\ttest_tick && git commit -m "Modified the file identically" &&\n'> <'\tnote C &&\n'> <'\n'> <'\techo "This is a stupid example" >another-file &&\n'> <'\tgit add another-file &&\n'> <'\ttest_tick && git commit -m "Add another file" &&\n'> <'\tnote D &&\n'> <'\n'> <'\ttest_tick &&\n'> <'\ttest_must_fail git merge -m "merge" master &&\n'> <'\t>lost && git commit -a -m "merge" &&\n'> <'\tnote E &&\n'> <'\n'> <'\techo "Yet another" >elif &&\n'> <'\tgit add elif &&\n'> <'\ttest_tick && git commit -m "Irrelevant change" &&\n'> <'\tnote F &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\techo "Yet another" >elif &&\n'> <'\tgit add elif &&\n'> <'\ttest_tick && git commit -m "Another irrelevant change" &&\n'> <'\tnote G &&\n'> <'\n'> <'\ttest_tick && git merge -m "merge" other-branch &&\n'> <'\tnote H &&\n'> <'\n'> <'\techo "Final change" >file &&\n'> <'\ttest_tick && git commit -a -m "Final change" &&\n'> <'\tnote I &&\n'> <'\n'> <'\tgit symbolic-ref HEAD refs/heads/unrelated &&\n'> <'\tgit rm -f "*" &&\n'> <'\techo "Unrelated branch" >side &&\n'> <'\tgit add side &&\n'> <'\ttest_tick && git commit -m "Side root" &&\n'> <'\tnote J &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\ttest_tick && git merge --allow-unrelated-histories -m "Coolest" unrelated &&\n'> <'\tnote K &&\n'> <'\n'> <'\techo "Immaterial" >elif &&\n'> <'\tgit add elif &&\n'> <'\ttest_tick && git commit -m "Last" &&\n'> <'\tnote L\n'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FMT) op: assign_op.Equal rhs: {(SQ <'tformat:%P \t%H | %s'>)} spids: [145] ) ] ) (command.ShFunction name: check_outcome body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:outcome) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [159] ) ] ) (C {<shift>}) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.ForEach iter_name: c iter_words: [{($ Id.VSub_Number '$1')}] do_arg_iter: F body: (command.DoGroup children:[(C {<echo>} {(DQ ($ Id.VSub_DollarName '$c'))})]) redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})] ) (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:param) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Star '$*'))} spids: [198] ) ] ) (C {<test_expect_> ($ Id.VSub_DollarName '$outcome')} {(DQ <'log '> ($ Id.VSub_DollarName '$param'))} { (SQ <'\n'> <'\t\tgit log --pretty="$FMT" --parents $param |\n'> <'\t\tunnote >actual &&\n'> <'\t\tsed -e "s/^.*\t\\([^ ]*\\) .*/\\1/" >check <actual &&\n'> <'\t\ttest_cmp expect check\n'> <'\t'> ) } ) ] ) ] ) ) (command.ShFunction name: check_result body: (BraceGroup children:[(C {<check_outcome>} {<success>} {(DQ ($ Id.VSub_At '$@'))})]) ) (C {<check_result>} {(SQ <'L K J I H G F E D C B A'>)} {<--full-history>}) (C {<check_result>} {(SQ <'K I H E C B A'>)} {<--full-history>} {<-->} {<file>}) (C {<check_result>} {(SQ <'K I H E C B A'>)} {<--full-history>} {<--topo-order>} {<-->} {<file>}) (C {<check_result>} {(SQ <'K I H E C B A'>)} {<--full-history>} {<--date-order>} {<-->} {<file>}) (C {<check_result>} {(SQ <'I E C B A'>)} {<--simplify-merges>} {<-->} {<file>}) (C {<check_result>} {(SQ <'I B A'>)} {<-->} {<file>}) (C {<check_result>} {(SQ <'I B A'>)} {<--topo-order>} {<-->} {<file>}) (C {<check_result>} {(SQ <H>)} {<--first-parent>} {<-->} {<another-file>}) (C {<check_result>} {(SQ <'E C B A'>)} {<--full-history>} {<E>} {<-->} {<lost>}) (C {<test_expect_success>} {(SQ <'full history simplification without parent'>)} { (SQ <'\n'> <'\tprintf "%s\\n" E C B A >expect &&\n'> <'\tgit log --pretty="$FMT" --full-history E -- lost |\n'> <'\tunnote >actual &&\n'> <'\tsed -e "s/^.*\t\\([^ ]*\\) .*/\\1/" >check <actual &&\n'> <'\ttest_cmp expect check\n'> ) } ) (C {<test_expect_success>} {(SQ <'--full-diff is not affected by --parents'>)} { (SQ <'\n'> <'\tgit log -p --pretty="%H" --full-diff -- file >expected &&\n'> <'\tgit log -p --pretty="%H" --full-diff --parents -- file >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_done>}) ] )