line-range: reject -L line numbers less than 1
[git/gitweb.git] / t / t6017-rev-list-stdin.sh
blob667b37564e3d31ca060216e841b9a5d9e385c165
1 #!/bin/sh
3 # Copyright (c) 2009, Junio C Hamano
6 test_description='log family learns --stdin'
8 . ./test-lib.sh
10 check () {
11 for cmd in rev-list "log --stat"
13 for i in "$@"
15 printf "%s\n" $i
16 done >input &&
17 test_expect_success "check $cmd $*" '
18 git $cmd $(cat input) >expect &&
19 git $cmd --stdin <input >actual &&
20 sed -e "s/^/input /" input &&
21 sed -e "s/^/output /" expect &&
22 test_cmp expect actual
24 done
27 them='1 2 3 4 5 6 7'
29 test_expect_success setup '
31 for i in 0 $them
33 for j in $them
35 echo $i.$j >file-$j &&
36 git add file-$j || exit
37 done &&
38 test_tick &&
39 git commit -m $i || exit
40 done &&
41 for i in $them
43 git checkout -b side-$i master~$i &&
44 echo updated $i >file-$i &&
45 git add file-$i &&
46 test_tick &&
47 git commit -m side-$i || exit
48 done
52 check master
53 check side-1 ^side-4
54 check side-1 ^side-7 --
55 check side-1 ^side-7 -- file-1
56 check side-1 ^side-7 -- file-2
57 check side-3 ^side-4 -- file-3
58 check side-3 ^side-2
59 check side-3 ^side-2 -- file-1
61 test_expect_success 'not only --stdin' '
62 cat >expect <<-EOF &&
65 file-1
66 file-2
67 EOF
68 cat >input <<-EOF &&
69 ^master^
71 file-2
72 EOF
73 git log --pretty=tformat:%s --name-only --stdin master -- file-1 \
74 <input >actual &&
75 test_cmp expect actual
78 test_done