1#!/bin/sh23test_description='merge simplification'45. ./test-lib.sh67note () {8git tag "$1"9}1011unnote () {12git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"13}1415test_expect_success setup '16echo "Hi there" >file &&17git add file &&18test_tick && git commit -m "Initial file" &&19note A &&2021git branch other-branch &&2223echo "Hello" >file &&24git add file &&25test_tick && git commit -m "Modified file" &&26note B &&2728git checkout other-branch &&2930echo "Hello" >file &&31git add file &&32test_tick && git commit -m "Modified the file identically" &&33note C &&3435echo "This is a stupid example" >another-file &&36git add another-file &&37test_tick && git commit -m "Add another file" &&38note D &&3940test_tick && git merge -m "merge" master &&41note E &&4243echo "Yet another" >elif &&44git add elif &&45test_tick && git commit -m "Irrelevant change" &&46note F &&4748git checkout master &&49echo "Yet another" >elif &&50git add elif &&51test_tick && git commit -m "Another irrelevant change" &&52note G &&5354test_tick && git merge -m "merge" other-branch &&55note H &&5657echo "Final change" >file &&58test_tick && git commit -a -m "Final change" &&59note I60'6162FMT='tformat:%P %H | %s'6364check_result () {65for c in $166do67echo "$c"68done >expect &&69shift &&70param="$*" &&71test_expect_success "log $param" '72git log --pretty="$FMT" --parents $param |73unnote >actual &&74sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&75test_cmp expect check || {76cat actual77false78}79'80}8182check_result 'I H G F E D C B A' --full-history83check_result 'I H E C B A' --full-history -- file84check_result 'I H E C B A' --full-history --topo-order -- file85check_result 'I H E C B A' --full-history --date-order -- file86check_result 'I E C B A' --simplify-merges -- file87check_result 'I B A' -- file88check_result 'I B A' --topo-order -- file89check_result 'H' --first-parent -- another-file9091test_done