3 test_description='merge simplification'
12 git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"
15 test_expect_success setup '
16 echo "Hi there" >file &&
17 echo "initial" >lost &&
19 test_tick && git commit -m "Initial file and lost" &&
22 git branch other-branch &&
25 echo "second" >lost &&
27 test_tick && git commit -m "Modified file and lost" &&
30 git checkout other-branch &&
35 test_tick && git commit -m "Modified the file identically" &&
38 echo "This is a stupid example" >another-file &&
39 git add another-file &&
40 test_tick && git commit -m "Add another file" &&
44 test_must_fail git merge -m "merge" master &&
45 >lost && git commit -a -m "merge" &&
48 echo "Yet another" >elif &&
50 test_tick && git commit -m "Irrelevant change" &&
53 git checkout master &&
54 echo "Yet another" >elif &&
56 test_tick && git commit -m "Another irrelevant change" &&
59 test_tick && git merge -m "merge" other-branch &&
62 echo "Final change" >file &&
63 test_tick && git commit -a -m "Final change" &&
66 git symbolic-ref HEAD refs/heads/unrelated &&
68 echo "Unrelated branch" >side &&
70 test_tick && git commit -m "Side root" &&
73 git checkout master &&
74 test_tick && git merge --allow-unrelated-histories -m "Coolest" unrelated &&
77 echo "Immaterial" >elif &&
79 test_tick && git commit -m "Last" &&
83 FMT='tformat:%P %H | %s'
94 test_expect_$outcome "log $param" '
95 git log --pretty="$FMT" --parents $param |
97 sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
103 check_outcome success "$@"
106 check_result 'L K J I H G F E D C B A' --full-history
107 check_result 'K I H E C B A' --full-history -- file
108 check_result 'K I H E C B A' --full-history --topo-order -- file
109 check_result 'K I H E C B A' --full-history --date-order -- file
110 check_result 'I E C B A' --simplify-merges -- file
111 check_result 'I B A' -- file
112 check_result 'I B A' --topo-order -- file
113 check_result 'H' --first-parent -- another-file
115 check_result 'E C B A' --full-history E -- lost
116 test_expect_success 'full history simplification without parent' '
117 printf "%s\n" E C B A >expect &&
118 git log --pretty="$FMT" --full-history E -- lost |
120 sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
121 test_cmp expect check
124 test_expect_success '--full-diff is not affected by --parents' '
125 git log -p --pretty="%H" --full-diff -- file >expected &&
126 git log -p --pretty="%H" --full-diff --parents -- file >actual &&
127 test_cmp expected actual