archive: handle commits with an empty tree
[git/jnareb-git.git] / t / t6012-rev-list-simplify.sh
blob839ad97b791c6aa757d0b82eea7fc16369ad4586
1 #!/bin/sh
3 test_description='merge simplification'
5 . ./test-lib.sh
7 note () {
8 git tag "$1"
11 unnote () {
12 git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"
15 test_expect_success setup '
16 echo "Hi there" >file &&
17 git add file &&
18 test_tick && git commit -m "Initial file" &&
19 note A &&
21 git branch other-branch &&
23 echo "Hello" >file &&
24 git add file &&
25 test_tick && git commit -m "Modified file" &&
26 note B &&
28 git checkout other-branch &&
30 echo "Hello" >file &&
31 git add file &&
32 test_tick && git commit -m "Modified the file identically" &&
33 note C &&
35 echo "This is a stupid example" >another-file &&
36 git add another-file &&
37 test_tick && git commit -m "Add another file" &&
38 note D &&
40 test_tick && git merge -m "merge" master &&
41 note E &&
43 echo "Yet another" >elif &&
44 git add elif &&
45 test_tick && git commit -m "Irrelevant change" &&
46 note F &&
48 git checkout master &&
49 echo "Yet another" >elif &&
50 git add elif &&
51 test_tick && git commit -m "Another irrelevant change" &&
52 note G &&
54 test_tick && git merge -m "merge" other-branch &&
55 note H &&
57 echo "Final change" >file &&
58 test_tick && git commit -a -m "Final change" &&
59 note I
62 FMT='tformat:%P %H | %s'
64 check_result () {
65 for c in $1
67 echo "$c"
68 done >expect &&
69 shift &&
70 param="$*" &&
71 test_expect_success "log $param" '
72 git log --pretty="$FMT" --parents $param |
73 unnote >actual &&
74 sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
75 test_cmp expect check || {
76 cat actual
77 false
82 check_result 'I H G F E D C B A' --full-history
83 check_result 'I H E C B A' --full-history -- file
84 check_result 'I H E C B A' --full-history --topo-order -- file
85 check_result 'I H E C B A' --full-history --date-order -- file
86 check_result 'I E C B A' --simplify-merges -- file
87 check_result 'I B A' -- file
88 check_result 'I B A' --topo-order -- file
89 check_result 'H' --first-parent -- another-file
91 test_done