Merge branch 'ab/refs-various-fixes'
[alt-git.git] / t / t6005-rev-list-count.sh
blobe960049f647cfca4a18defaba7dde9d43c8f94ef
1 #!/bin/sh
3 test_description='git rev-list --max-count and --skip test'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 for n in 1 2 3 4 5 ; do
9 echo $n > a &&
10 git add a &&
11 git commit -m "$n" || return 1
12 done
15 test_expect_success 'no options' '
16 test_stdout_line_count = 5 git rev-list HEAD
19 test_expect_success '--max-count' '
20 test_stdout_line_count = 0 git rev-list HEAD --max-count=0 &&
21 test_stdout_line_count = 3 git rev-list HEAD --max-count=3 &&
22 test_stdout_line_count = 5 git rev-list HEAD --max-count=5 &&
23 test_stdout_line_count = 5 git rev-list HEAD --max-count=10
26 test_expect_success '--max-count all forms' '
27 test_stdout_line_count = 1 git rev-list HEAD --max-count=1 &&
28 test_stdout_line_count = 1 git rev-list HEAD -1 &&
29 test_stdout_line_count = 1 git rev-list HEAD -n1 &&
30 test_stdout_line_count = 1 git rev-list HEAD -n 1
33 test_expect_success '--skip' '
34 test_stdout_line_count = 5 git rev-list HEAD --skip=0 &&
35 test_stdout_line_count = 2 git rev-list HEAD --skip=3 &&
36 test_stdout_line_count = 0 git rev-list HEAD --skip=5 &&
37 test_stdout_line_count = 0 git rev-list HEAD --skip=10
40 test_expect_success '--skip --max-count' '
41 test_stdout_line_count = 0 git rev-list HEAD --skip=0 --max-count=0 &&
42 test_stdout_line_count = 5 git rev-list HEAD --skip=0 --max-count=10 &&
43 test_stdout_line_count = 0 git rev-list HEAD --skip=3 --max-count=0 &&
44 test_stdout_line_count = 1 git rev-list HEAD --skip=3 --max-count=1 &&
45 test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=2 &&
46 test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=10 &&
47 test_stdout_line_count = 0 git rev-list HEAD --skip=5 --max-count=10 &&
48 test_stdout_line_count = 0 git rev-list HEAD --skip=10 --max-count=10
51 test_done