Last minute fixes before -rc1
[alt-git.git] / t / t6005-rev-list-count.sh
blob86542c650e241976943ca58c5496cf03965c630e
1 #!/bin/sh
3 test_description='git rev-list --max-count and --skip test'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'setup' '
9 for n in 1 2 3 4 5 ; do
10 echo $n > a &&
11 git add a &&
12 git commit -m "$n" || return 1
13 done
16 test_expect_success 'no options' '
17 test $(git rev-list HEAD | wc -l) = 5
20 test_expect_success '--max-count' '
21 test $(git rev-list HEAD --max-count=0 | wc -l) = 0 &&
22 test $(git rev-list HEAD --max-count=3 | wc -l) = 3 &&
23 test $(git rev-list HEAD --max-count=5 | wc -l) = 5 &&
24 test $(git rev-list HEAD --max-count=10 | wc -l) = 5
27 test_expect_success '--max-count all forms' '
28 test $(git rev-list HEAD --max-count=1 | wc -l) = 1 &&
29 test $(git rev-list HEAD -1 | wc -l) = 1 &&
30 test $(git rev-list HEAD -n1 | wc -l) = 1 &&
31 test $(git rev-list HEAD -n 1 | wc -l) = 1
34 test_expect_success '--skip' '
35 test $(git rev-list HEAD --skip=0 | wc -l) = 5 &&
36 test $(git rev-list HEAD --skip=3 | wc -l) = 2 &&
37 test $(git rev-list HEAD --skip=5 | wc -l) = 0 &&
38 test $(git rev-list HEAD --skip=10 | wc -l) = 0
41 test_expect_success '--skip --max-count' '
42 test $(git rev-list HEAD --skip=0 --max-count=0 | wc -l) = 0 &&
43 test $(git rev-list HEAD --skip=0 --max-count=10 | wc -l) = 5 &&
44 test $(git rev-list HEAD --skip=3 --max-count=0 | wc -l) = 0 &&
45 test $(git rev-list HEAD --skip=3 --max-count=1 | wc -l) = 1 &&
46 test $(git rev-list HEAD --skip=3 --max-count=2 | wc -l) = 2 &&
47 test $(git rev-list HEAD --skip=3 --max-count=10 | wc -l) = 2 &&
48 test $(git rev-list HEAD --skip=5 --max-count=10 | wc -l) = 0 &&
49 test $(git rev-list HEAD --skip=10 --max-count=10 | wc -l) = 0
52 test_done