recv_sideband: Bands #2 and #3 always go to stderr
[alt-git.git] / t / t4202-log.sh
blob6d43459dd1639e45b532f8b58b3e189a573a6fb0
1 #!/bin/sh
3 test_description='git log'
5 . ./test-lib.sh
7 test_expect_success setup '
9 echo one >one &&
10 git add one &&
11 test_tick &&
12 git commit -m initial &&
14 echo ichi >one &&
15 git add one &&
16 test_tick &&
17 git commit -m second &&
19 git mv one ichi &&
20 test_tick &&
21 git commit -m third &&
23 cp ichi ein &&
24 git add ein &&
25 test_tick &&
26 git commit -m fourth &&
28 mkdir a &&
29 echo ni >a/two &&
30 git add a/two &&
31 test_tick &&
32 git commit -m fifth &&
34 git rm a/two &&
35 test_tick &&
36 git commit -m sixth
40 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
41 test_expect_success 'pretty' '
43 git log --pretty="format:%s" > actual &&
44 test_cmp expect actual
47 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
48 test_expect_success 'pretty (tformat)' '
50 git log --pretty="tformat:%s" > actual &&
51 test_cmp expect actual
54 test_expect_success 'pretty (shortcut)' '
56 git log --pretty="%s" > actual &&
57 test_cmp expect actual
60 test_expect_success 'format' '
62 git log --format="%s" > actual &&
63 test_cmp expect actual
66 cat > expect << EOF
67 804a787 sixth
68 394ef78 fifth
69 5d31159 fourth
70 2fbe8c0 third
71 f7dab8e second
72 3a2fdcb initial
73 EOF
74 test_expect_success 'oneline' '
76 git log --oneline > actual &&
77 test_cmp expect actual
80 test_expect_success 'diff-filter=A' '
82 actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) &&
83 expect=$(echo fifth ; echo fourth ; echo third ; echo initial) &&
84 test "$actual" = "$expect" || {
85 echo Oops
86 echo "Actual: $actual"
87 false
92 test_expect_success 'diff-filter=M' '
94 actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
95 expect=$(echo second) &&
96 test "$actual" = "$expect" || {
97 echo Oops
98 echo "Actual: $actual"
99 false
104 test_expect_success 'diff-filter=D' '
106 actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
107 expect=$(echo sixth ; echo third) &&
108 test "$actual" = "$expect" || {
109 echo Oops
110 echo "Actual: $actual"
111 false
116 test_expect_success 'diff-filter=R' '
118 actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
119 expect=$(echo third) &&
120 test "$actual" = "$expect" || {
121 echo Oops
122 echo "Actual: $actual"
123 false
128 test_expect_success 'diff-filter=C' '
130 actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
131 expect=$(echo fourth) &&
132 test "$actual" = "$expect" || {
133 echo Oops
134 echo "Actual: $actual"
135 false
140 test_expect_success 'git log --follow' '
142 actual=$(git log --follow --pretty="format:%s" ichi) &&
143 expect=$(echo third ; echo second ; echo initial) &&
144 test "$actual" = "$expect" || {
145 echo Oops
146 echo "Actual: $actual"
147 false
152 test_expect_success 'setup case sensitivity tests' '
153 echo case >one &&
154 test_tick &&
155 git add one
156 git commit -a -m Second
159 test_expect_success 'log --grep' '
160 echo second >expect &&
161 git log -1 --pretty="tformat:%s" --grep=sec >actual &&
162 test_cmp expect actual
165 test_expect_success 'log -i --grep' '
166 echo Second >expect &&
167 git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
168 test_cmp expect actual
171 test_expect_success 'log --grep -i' '
172 echo Second >expect &&
173 git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
174 test_cmp expect actual
177 test_done