Merge branch 'ja/doc-synopsis-markup'
[git/gitster.git] / t / t6100-rev-list-in-order.sh
blob88ed7bd75a75f0d8eb730d2f3db7dc59afe7807f
1 #!/bin/sh
3 test_description='rev-list testing in-commit-order'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'setup a commit history with trees, blobs' '
9 for x in one two three four
11 echo $x >$x &&
12 git add $x &&
13 git commit -m "add file $x" ||
14 return 1
15 done &&
16 for x in four three
18 git rm $x &&
19 git commit -m "remove $x" ||
20 return 1
21 done
24 test_expect_success 'rev-list --in-commit-order' '
25 git rev-list --in-commit-order --objects HEAD >actual.raw &&
26 cut -d" " -f1 >actual <actual.raw &&
28 git cat-file --batch-check="%(objectname)" >expect.raw <<-\EOF &&
29 HEAD^{commit}
30 HEAD^{tree}
31 HEAD^{tree}:one
32 HEAD^{tree}:two
33 HEAD~1^{commit}
34 HEAD~1^{tree}
35 HEAD~1^{tree}:three
36 HEAD~2^{commit}
37 HEAD~2^{tree}
38 HEAD~2^{tree}:four
39 HEAD~3^{commit}
40 # HEAD~3^{tree} skipped, same as HEAD~1^{tree}
41 HEAD~4^{commit}
42 # HEAD~4^{tree} skipped, same as HEAD^{tree}
43 HEAD~5^{commit}
44 HEAD~5^{tree}
45 EOF
46 grep -v "#" >expect <expect.raw &&
48 test_cmp expect actual
51 test_expect_success 'rev-list lists blobs and trees after commits' '
52 git rev-list --objects HEAD >actual.raw &&
53 cut -d" " -f1 >actual <actual.raw &&
55 git cat-file --batch-check="%(objectname)" >expect.raw <<-\EOF &&
56 HEAD^{commit}
57 HEAD~1^{commit}
58 HEAD~2^{commit}
59 HEAD~3^{commit}
60 HEAD~4^{commit}
61 HEAD~5^{commit}
62 HEAD^{tree}
63 HEAD^{tree}:one
64 HEAD^{tree}:two
65 HEAD~1^{tree}
66 HEAD~1^{tree}:three
67 HEAD~2^{tree}
68 HEAD~2^{tree}:four
69 # HEAD~3^{tree} skipped, same as HEAD~1^{tree}
70 # HEAD~4^{tree} skipped, same as HEAD^{tree}
71 HEAD~5^{tree}
72 EOF
73 grep -v "#" >expect <expect.raw &&
75 test_cmp expect actual
78 test_done