3 test_description
='ancestor culling and limiting by parent number'
10 git rev-parse
"$@" >expect
&&
11 git rev-list
$rev_list_args --all >actual
&&
12 test_cmp expect actual
15 test_expect_success setup
'
22 test_tick=$(($test_tick - 2400)) &&
28 git log --pretty=oneline --abbrev-commit
31 test_expect_success
'one is ancestor of others and should not be shown' '
33 git rev-list one --not four >result &&
35 test_cmp expect result
39 test_expect_success
'setup roots, merges and octopuses' '
41 git checkout --orphan newroot &&
43 git checkout -b sidebranch two &&
45 git checkout -b anotherbranch three &&
47 git checkout -b yetanotherbranch four &&
49 git checkout master &&
51 git merge --allow-unrelated-histories -m normalmerge newroot &&
52 git tag normalmerge &&
54 git merge -m tripus sidebranch anotherbranch &&
56 git checkout -b tetrabranch normalmerge &&
58 git merge -m tetrapus sidebranch anotherbranch yetanotherbranch &&
63 test_expect_success
'rev-list roots' '
65 check_revlist "--max-parents=0" one five
68 test_expect_success
'rev-list no merges' '
70 check_revlist "--max-parents=1" one eight seven six five four three two &&
71 check_revlist "--no-merges" one eight seven six five four three two
74 test_expect_success
'rev-list no octopuses' '
76 check_revlist "--max-parents=2" one normalmerge eight seven six five four three two
79 test_expect_success
'rev-list no roots' '
81 check_revlist "--min-parents=1" tetrapus tripus normalmerge eight seven six four three two
84 test_expect_success
'rev-list merges' '
86 check_revlist "--min-parents=2" tetrapus tripus normalmerge &&
87 check_revlist "--merges" tetrapus tripus normalmerge
90 test_expect_success
'rev-list octopus' '
92 check_revlist "--min-parents=3" tetrapus tripus
95 test_expect_success
'rev-list ordinary commits' '
97 check_revlist "--min-parents=1 --max-parents=1" eight seven six four three two
100 test_expect_success
'rev-list --merges --no-merges yields empty set' '
102 check_revlist "--min-parents=2 --no-merges" &&
103 check_revlist "--merges --no-merges" &&
104 check_revlist "--no-merges --merges"
107 test_expect_success
'rev-list override and infinities' '
109 check_revlist "--min-parents=2 --max-parents=1 --max-parents=3" tripus normalmerge &&
110 check_revlist "--min-parents=1 --min-parents=2 --max-parents=7" tetrapus tripus normalmerge &&
111 check_revlist "--min-parents=2 --max-parents=8" tetrapus tripus normalmerge &&
112 check_revlist "--min-parents=2 --max-parents=-1" tetrapus tripus normalmerge &&
113 check_revlist "--min-parents=2 --no-max-parents" tetrapus tripus normalmerge &&
114 check_revlist "--max-parents=0 --min-parents=1 --no-min-parents" one five
117 test_expect_success
'dodecapus' '
120 for i in 1 2 3 4 5 6 7 8 9 10 11
122 git checkout -b root$i five &&
124 roots="$roots root$i" ||
127 git checkout master &&
129 git merge -m dodecapus $roots &&
132 check_revlist "--min-parents=4" dodecapus tetrapus &&
133 check_revlist "--min-parents=8" dodecapus &&
134 check_revlist "--min-parents=12" dodecapus &&
135 check_revlist "--min-parents=13" &&
136 check_revlist "--min-parents=4 --max-parents=11" tetrapus
139 test_expect_success
'ancestors with the same commit time' '
141 test_tick_keep=$test_tick &&
142 for i in 1 2 3 4 5 6 7 8; do
143 test_tick=$test_tick_keep
146 git rev-list t1^! --not t$i >result &&
148 test_cmp expect result