3 # There's more than one "correct" way to represent the history graphically.
4 # These tests depend on the current behavior of the graphing code. If the
5 # graphing code is ever changed to draw the output differently, these tests
6 # cases will need to be updated to know about the new layout.
8 test_description='--graph and simplified history'
10 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
11 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
14 . "$TEST_DIRECTORY"/lib-log-graph.sh
18 lib_test_cmp_graph --format=%s "$@"
21 test_expect_success 'set up rev-list --graph test' '
22 # 3 commits on branch A
23 test_commit A1 foo.txt &&
24 test_commit A2 bar.txt &&
25 test_commit A3 bar.txt &&
26 git branch -m main A &&
28 # 2 commits on branch B, started from A1
29 git checkout -b B A1 &&
30 test_commit B1 foo.txt &&
31 test_commit B2 abc.txt &&
33 # 2 commits on branch C, started from A2
34 git checkout -b C A2 &&
35 test_commit C1 xyz.txt &&
36 test_commit C2 xyz.txt &&
38 # Octopus merge B and C into branch A
40 git merge B C -m A4 &&
43 test_commit A5 bar.txt &&
45 # More commits on C, then merge C into A
47 test_commit C3 foo.txt &&
48 test_commit C4 bar.txt &&
50 git merge -s ours C -m A6 &&
53 test_commit A7 bar.txt
56 test_expect_success '--graph --all' '
57 check_graph --all <<-\EOF
81 # Make sure the graph_is_interesting() code still realizes
82 # that undecorated merges are interesting, even with --simplify-by-decoration
83 test_expect_success '--graph --simplify-by-decoration' '
85 check_graph --all --simplify-by-decoration <<-\EOF
109 test_expect_success 'setup: get rid of decorations on B' '
115 # Graph with branch B simplified away
116 test_expect_success '--graph --simplify-by-decoration prune branch B' '
117 check_graph --simplify-by-decoration --all <<-\EOF
135 test_expect_success '--graph --full-history -- bar.txt' '
136 check_graph --full-history --all -- bar.txt <<-\EOF
150 test_expect_success '--graph --full-history --simplify-merges -- bar.txt' '
151 check_graph --full-history --simplify-merges --all -- bar.txt <<-\EOF
163 test_expect_success '--graph -- bar.txt' '
164 check_graph --all -- bar.txt <<-\EOF
174 test_expect_success '--graph --sparse -- bar.txt' '
175 check_graph --sparse --all -- bar.txt <<-\EOF
191 test_expect_success '--graph ^C4' '
192 check_graph --all ^C4 <<-\EOF
204 test_expect_success '--graph ^C3' '
205 check_graph --all ^C3 <<-\EOF
219 # I don't think the ordering of the boundary commits is really
220 # that important, but this test depends on it. If the ordering ever changes
221 # in the code, we'll need to update this test.
222 test_expect_success '--graph --boundary ^C3' '
223 check_graph --boundary --all ^C3 <<-\EOF