3 # Copyright (c) 2006 Junio C Hamano
6 test_description
='Various diff formatting options'
10 test_expect_success setup
'
12 GIT_AUTHOR_DATE="2006-06-26 00:00:00 +0000" &&
13 GIT_COMMITTER_DATE="2006-06-26 00:00:00 +0000" &&
14 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
17 for i in 1 2 3; do echo $i; done >file0 &&
18 for i in A B; do echo $i; done >dir/sub &&
20 git add file0 file2 dir/sub &&
21 git commit -m Initial &&
26 GIT_AUTHOR_DATE="2006-06-26 00:01:00 +0000" &&
27 GIT_COMMITTER_DATE="2006-06-26 00:01:00 +0000" &&
28 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
30 for i in 4 5 6; do echo $i; done >>file0 &&
31 for i in C D; do echo $i; done >>dir/sub &&
33 git update-index --remove file0 file2 dir/sub &&
34 git commit -m Second &&
36 GIT_AUTHOR_DATE="2006-06-26 00:02:00 +0000" &&
37 GIT_COMMITTER_DATE="2006-06-26 00:02:00 +0000" &&
38 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
40 for i in A B C; do echo $i; done >file1 &&
42 for i in E F; do echo $i; done >>dir/sub &&
43 git update-index dir/sub &&
44 git commit -m Third &&
46 GIT_AUTHOR_DATE="2006-06-26 00:03:00 +0000" &&
47 GIT_COMMITTER_DATE="2006-06-26 00:03:00 +0000" &&
48 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
51 for i in A B C; do echo $i; done >>file0 &&
52 for i in 1 2; do echo $i; done >>dir/sub &&
55 git update-index file0 dir/sub &&
58 GIT_AUTHOR_DATE="2006-06-26 00:04:00 +0000" &&
59 GIT_COMMITTER_DATE="2006-06-26 00:04:00 +0000" &&
60 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
62 git checkout master &&
63 git pull -s ours . side &&
65 GIT_AUTHOR_DATE="2006-06-26 00:05:00 +0000" &&
66 GIT_COMMITTER_DATE="2006-06-26 00:05:00 +0000" &&
67 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
69 for i in A B C; do echo $i; done >>file0 &&
70 for i in 1 2; do echo $i; done >>dir/sub &&
71 git update-index file0 dir/sub &&
79 * [master
] Merge branch
'side'
82 - [master
] Merge branch
'side'
88 V
=`git version | sed -e 's/^git version //'`
92 '' |
'#'*) continue ;;
94 test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
95 cnt
=`expr $test_count + 1`
96 pfx
=`printf "%04d" $cnt`
97 expect
="../t4013/diff.$test"
98 actual
="$pfx-diff.$test"
100 test_expect_success
"git $cmd" '
103 git $cmd | sed -e "s/$V/g-i-t--v-e-r-s-i-o-n/"
108 diff -u "$expect" "$actual" &&
111 # this is to help developing new tests.
112 cp "$actual" "$expect"
119 diff-tree
-r --abbrev initial
120 diff-tree
-r --abbrev=4 initial
121 diff-tree
--root initial
122 diff-tree
--root --abbrev initial
123 diff-tree
--root -r initial
124 diff-tree
--root -r --abbrev initial
125 diff-tree
--root -r --abbrev=4 initial
127 diff-tree
--root -p initial
128 diff-tree
--patch-with-stat initial
129 diff-tree
--root --patch-with-stat initial
130 diff-tree
--patch-with-raw initial
131 diff-tree
--root --patch-with-raw initial
133 diff-tree
--pretty initial
134 diff-tree
--pretty --root initial
135 diff-tree
--pretty -p initial
136 diff-tree
--pretty --stat initial
137 diff-tree
--pretty --summary initial
138 diff-tree
--pretty --stat --summary initial
139 diff-tree
--pretty --root -p initial
140 diff-tree
--pretty --root --stat initial
141 # improved by Timo's patch
142 diff-tree
--pretty --root --summary initial
143 # improved by Timo's patch
144 diff-tree
--pretty --root --summary -r initial
145 diff-tree
--pretty --root --stat --summary initial
146 diff-tree
--pretty --patch-with-stat initial
147 diff-tree
--pretty --root --patch-with-stat initial
148 diff-tree
--pretty --patch-with-raw initial
149 diff-tree
--pretty --root --patch-with-raw initial
151 diff-tree
--pretty=oneline initial
152 diff-tree
--pretty=oneline
--root initial
153 diff-tree
--pretty=oneline
-p initial
154 diff-tree
--pretty=oneline
--root -p initial
155 diff-tree
--pretty=oneline
--patch-with-stat initial
156 # improved by Timo's patch
157 diff-tree
--pretty=oneline
--root --patch-with-stat initial
158 diff-tree
--pretty=oneline
--patch-with-raw initial
159 diff-tree
--pretty=oneline
--root --patch-with-raw initial
161 diff-tree
--pretty side
162 diff-tree
--pretty -p side
163 diff-tree
--pretty --patch-with-stat side
167 diff-tree
-p -m master
169 diff-tree
-c --abbrev master
170 diff-tree
--cc master
171 # stat only should show the diffstat with the first parent
172 diff-tree
-c --stat master
173 diff-tree
--cc --stat master
174 diff-tree
-c --stat --summary master
175 diff-tree
--cc --stat --summary master
176 # stat summary should show the diffstat and summary with the first parent
177 diff-tree
-c --stat --summary side
178 diff-tree
--cc --stat --summary side
179 # improved by Timo's patch
180 diff-tree
--cc --patch-with-stat master
181 # improved by Timo's patch
182 diff-tree
--cc --patch-with-stat --summary master
184 diff-tree
--cc --patch-with-stat --summary side
190 log
--patch-with-stat master
191 log
--root --patch-with-stat master
192 log
--root --patch-with-stat --summary master
193 # improved by Timo's patch
194 log
--root -c --patch-with-stat --summary master
195 # improved by Timo's patch
196 log
--root --cc --patch-with-stat --summary master
201 whatchanged
-p master
202 whatchanged
--root master
203 whatchanged
--root -p master
204 whatchanged
--patch-with-stat master
205 whatchanged
--root --patch-with-stat master
206 whatchanged
--root --patch-with-stat --summary master
207 # improved by Timo's patch
208 whatchanged
--root -c --patch-with-stat --summary master
209 # improved by Timo's patch
210 whatchanged
--root --cc --patch-with-stat --summary master
211 whatchanged
-SF master
212 whatchanged
-SF -p master
214 log
--patch-with-stat master
-- dir
/
215 whatchanged
--patch-with-stat master
-- dir
/
216 log
--patch-with-stat --summary master
-- dir
/
217 whatchanged
--patch-with-stat --summary master
-- dir
/
224 show
--stat --summary side
225 show
--patch-with-stat side
226 show
--patch-with-raw side
227 show
--patch-with-stat --summary side
229 format-patch
--stdout initial..side
230 format-patch
--stdout initial..master^
231 format-patch
--stdout initial..master
232 format-patch
--attach --stdout initial..side
233 format-patch
--attach --stdout initial..master^
234 format-patch
--attach --stdout initial..master
236 diff --abbrev initial..side
237 diff -r initial..side
238 diff --stat initial..side
239 diff -r --stat initial..side
241 diff --patch-with-stat initial..side
242 diff --patch-with-raw initial..side
243 diff --patch-with-stat -r initial..side
244 diff --patch-with-raw -r initial..side