3 test_description
='git rev-list --max-count and --skip test'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup' '
9 for n in 1 2 3 4 5 ; do
12 git commit -m "$n" || return 1
16 test_expect_success
'no options' '
17 test_stdout_line_count = 5 git rev-list HEAD
20 test_expect_success
'--max-count' '
21 test_stdout_line_count = 0 git rev-list HEAD --max-count=0 &&
22 test_stdout_line_count = 3 git rev-list HEAD --max-count=3 &&
23 test_stdout_line_count = 5 git rev-list HEAD --max-count=5 &&
24 test_stdout_line_count = 5 git rev-list HEAD --max-count=10
27 test_expect_success
'--max-count all forms' '
28 test_stdout_line_count = 1 git rev-list HEAD --max-count=1 &&
29 test_stdout_line_count = 1 git rev-list HEAD -1 &&
30 test_stdout_line_count = 1 git rev-list HEAD -n1 &&
31 test_stdout_line_count = 1 git rev-list HEAD -n 1
34 test_expect_success
'--skip' '
35 test_stdout_line_count = 5 git rev-list HEAD --skip=0 &&
36 test_stdout_line_count = 2 git rev-list HEAD --skip=3 &&
37 test_stdout_line_count = 0 git rev-list HEAD --skip=5 &&
38 test_stdout_line_count = 0 git rev-list HEAD --skip=10
41 test_expect_success
'--skip --max-count' '
42 test_stdout_line_count = 0 git rev-list HEAD --skip=0 --max-count=0 &&
43 test_stdout_line_count = 5 git rev-list HEAD --skip=0 --max-count=10 &&
44 test_stdout_line_count = 0 git rev-list HEAD --skip=3 --max-count=0 &&
45 test_stdout_line_count = 1 git rev-list HEAD --skip=3 --max-count=1 &&
46 test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=2 &&
47 test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=10 &&
48 test_stdout_line_count = 0 git rev-list HEAD --skip=5 --max-count=10 &&
49 test_stdout_line_count = 0 git rev-list HEAD --skip=10 --max-count=10