]>
Commit | Line | Data |
---|---|---|
0faf2da7 AL |
1 | #!/bin/sh |
2 | ||
3 | test_description='git log' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | test_expect_success setup ' | |
8 | ||
9 | echo one >one && | |
10 | git add one && | |
11 | test_tick && | |
12 | git commit -m initial && | |
13 | ||
14 | echo ichi >one && | |
15 | git add one && | |
16 | test_tick && | |
17 | git commit -m second && | |
18 | ||
d9305089 | 19 | git mv one ichi && |
0faf2da7 AL |
20 | test_tick && |
21 | git commit -m third && | |
22 | ||
d9305089 AL |
23 | cp ichi ein && |
24 | git add ein && | |
0faf2da7 AL |
25 | test_tick && |
26 | git commit -m fourth && | |
27 | ||
d9305089 AL |
28 | mkdir a && |
29 | echo ni >a/two && | |
30 | git add a/two && | |
31 | test_tick && | |
32 | git commit -m fifth && | |
33 | ||
34 | git rm a/two && | |
0faf2da7 | 35 | test_tick && |
d9305089 | 36 | git commit -m sixth |
0faf2da7 AL |
37 | |
38 | ' | |
39 | ||
40 | test_expect_success 'diff-filter=A' ' | |
41 | ||
42 | actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) && | |
d9305089 | 43 | expect=$(echo fifth ; echo fourth ; echo third ; echo initial) && |
0faf2da7 AL |
44 | test "$actual" = "$expect" || { |
45 | echo Oops | |
46 | echo "Actual: $actual" | |
47 | false | |
48 | } | |
49 | ||
50 | ' | |
51 | ||
52 | test_expect_success 'diff-filter=M' ' | |
53 | ||
54 | actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) && | |
55 | expect=$(echo second) && | |
56 | test "$actual" = "$expect" || { | |
57 | echo Oops | |
58 | echo "Actual: $actual" | |
59 | false | |
60 | } | |
61 | ||
62 | ' | |
63 | ||
64 | test_expect_success 'diff-filter=D' ' | |
65 | ||
66 | actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) && | |
d9305089 AL |
67 | expect=$(echo sixth ; echo third) && |
68 | test "$actual" = "$expect" || { | |
69 | echo Oops | |
70 | echo "Actual: $actual" | |
71 | false | |
72 | } | |
73 | ||
74 | ' | |
75 | ||
76 | test_expect_success 'diff-filter=R' ' | |
77 | ||
78 | actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) && | |
79 | expect=$(echo third) && | |
80 | test "$actual" = "$expect" || { | |
81 | echo Oops | |
82 | echo "Actual: $actual" | |
83 | false | |
84 | } | |
85 | ||
86 | ' | |
87 | ||
88 | test_expect_success 'diff-filter=C' ' | |
89 | ||
90 | actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) && | |
91 | expect=$(echo fourth) && | |
92 | test "$actual" = "$expect" || { | |
93 | echo Oops | |
94 | echo "Actual: $actual" | |
95 | false | |
96 | } | |
97 | ||
98 | ' | |
99 | ||
100 | test_expect_success 'git log --follow' ' | |
101 | ||
102 | actual=$(git log --follow --pretty="format:%s" ichi) && | |
103 | expect=$(echo third ; echo second ; echo initial) && | |
0faf2da7 AL |
104 | test "$actual" = "$expect" || { |
105 | echo Oops | |
106 | echo "Actual: $actual" | |
107 | false | |
108 | } | |
109 | ||
110 | ' | |
111 | ||
0843acfd JK |
112 | test_expect_success 'setup case sensitivity tests' ' |
113 | echo case >one && | |
114 | test_tick && | |
d9305089 | 115 | git add one |
0843acfd JK |
116 | git commit -a -m Second |
117 | ' | |
118 | ||
119 | test_expect_success 'log --grep' ' | |
120 | echo second >expect && | |
121 | git log -1 --pretty="tformat:%s" --grep=sec >actual && | |
122 | test_cmp expect actual | |
123 | ' | |
0faf2da7 | 124 | |
0843acfd JK |
125 | test_expect_success 'log -i --grep' ' |
126 | echo Second >expect && | |
127 | git log -1 --pretty="tformat:%s" -i --grep=sec >actual && | |
128 | test_cmp expect actual | |
129 | ' | |
130 | ||
131 | test_expect_success 'log --grep -i' ' | |
132 | echo Second >expect && | |
133 | git log -1 --pretty="tformat:%s" --grep=sec -i >actual && | |
134 | test_cmp expect actual | |
135 | ' | |
0faf2da7 | 136 | |
c65233fe BC |
137 | test_done |
138 |