3 # Copyright (c) 2006 Junio C Hamano
6 test_description
='Various diff formatting options'
13 test_expect_success setup
'
15 GIT_AUTHOR_DATE="2006-06-26 00:00:00 +0000" &&
16 GIT_COMMITTER_DATE="2006-06-26 00:00:00 +0000" &&
17 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
21 for i in 1 2 3; do echo $i; done >file0 &&
22 for i in A B; do echo $i; done >dir/sub &&
24 git add file0 file2 dir/sub &&
25 git commit -m Initial &&
30 GIT_AUTHOR_DATE="2006-06-26 00:01:00 +0000" &&
31 GIT_COMMITTER_DATE="2006-06-26 00:01:00 +0000" &&
32 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
34 for i in 4 5 6; do echo $i; done >>file0 &&
35 for i in C D; do echo $i; done >>dir/sub &&
37 git update-index --remove file0 file2 dir/sub &&
38 git commit -m "Second${LF}${LF}This is the second commit." &&
40 GIT_AUTHOR_DATE="2006-06-26 00:02:00 +0000" &&
41 GIT_COMMITTER_DATE="2006-06-26 00:02:00 +0000" &&
42 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
44 for i in A B C; do echo $i; done >file1 &&
46 for i in E F; do echo $i; done >>dir/sub &&
47 git update-index dir/sub &&
48 git commit -m Third &&
50 GIT_AUTHOR_DATE="2006-06-26 00:03:00 +0000" &&
51 GIT_COMMITTER_DATE="2006-06-26 00:03:00 +0000" &&
52 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
55 for i in A B C; do echo $i; done >>file0 &&
56 for i in 1 2; do echo $i; done >>dir/sub &&
59 git update-index file0 dir/sub &&
62 GIT_AUTHOR_DATE="2006-06-26 00:04:00 +0000" &&
63 GIT_COMMITTER_DATE="2006-06-26 00:04:00 +0000" &&
64 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
66 git checkout master &&
67 git pull -s ours . side &&
69 GIT_AUTHOR_DATE="2006-06-26 00:05:00 +0000" &&
70 GIT_COMMITTER_DATE="2006-06-26 00:05:00 +0000" &&
71 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
73 for i in A B C; do echo $i; done >>file0 &&
74 for i in 1 2; do echo $i; done >>dir/sub &&
75 git update-index file0 dir/sub &&
78 cp dir/sub dir3/sub &&
79 test-chmtime +1 dir3/sub &&
81 git config log.showroot false &&
88 * [master
] Merge branch
'side'
91 - [master
] Merge branch
'side'
97 V
=`git version | sed -e 's/^git version //' -e 's/\./\\./g'`
101 '' |
'#'*) continue ;;
103 test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
104 cnt
=`expr $test_count + 1`
105 pfx
=`printf "%04d" $cnt`
106 expect
="$TEST_DIRECTORY/t4013/diff.$test"
107 actual
="$pfx-diff.$test"
109 test_expect_success
"git $cmd" '
113 sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
114 -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
119 test_cmp "$expect" "$actual" &&
122 # this is to help developing new tests.
123 cp "$actual" "$expect"
130 diff-tree
-r --abbrev initial
131 diff-tree
-r --abbrev=4 initial
132 diff-tree
--root initial
133 diff-tree
--root --abbrev initial
134 diff-tree
--root -r initial
135 diff-tree
--root -r --abbrev initial
136 diff-tree
--root -r --abbrev=4 initial
138 diff-tree
--root -p initial
139 diff-tree
--patch-with-stat initial
140 diff-tree
--root --patch-with-stat initial
141 diff-tree
--patch-with-raw initial
142 diff-tree
--root --patch-with-raw initial
144 diff-tree
--pretty initial
145 diff-tree
--pretty --root initial
146 diff-tree
--pretty -p initial
147 diff-tree
--pretty --stat initial
148 diff-tree
--pretty --summary initial
149 diff-tree
--pretty --stat --summary initial
150 diff-tree
--pretty --root -p initial
151 diff-tree
--pretty --root --stat initial
152 # improved by Timo's patch
153 diff-tree
--pretty --root --summary initial
154 # improved by Timo's patch
155 diff-tree
--pretty --root --summary -r initial
156 diff-tree
--pretty --root --stat --summary initial
157 diff-tree
--pretty --patch-with-stat initial
158 diff-tree
--pretty --root --patch-with-stat initial
159 diff-tree
--pretty --patch-with-raw initial
160 diff-tree
--pretty --root --patch-with-raw initial
162 diff-tree
--pretty=oneline initial
163 diff-tree
--pretty=oneline
--root initial
164 diff-tree
--pretty=oneline
-p initial
165 diff-tree
--pretty=oneline
--root -p initial
166 diff-tree
--pretty=oneline
--patch-with-stat initial
167 # improved by Timo's patch
168 diff-tree
--pretty=oneline
--root --patch-with-stat initial
169 diff-tree
--pretty=oneline
--patch-with-raw initial
170 diff-tree
--pretty=oneline
--root --patch-with-raw initial
172 diff-tree
--pretty side
173 diff-tree
--pretty -p side
174 diff-tree
--pretty --patch-with-stat side
178 diff-tree
-p -m master
180 diff-tree
-c --abbrev master
181 diff-tree
--cc master
182 # stat only should show the diffstat with the first parent
183 diff-tree
-c --stat master
184 diff-tree
--cc --stat master
185 diff-tree
-c --stat --summary master
186 diff-tree
--cc --stat --summary master
187 # stat summary should show the diffstat and summary with the first parent
188 diff-tree
-c --stat --summary side
189 diff-tree
--cc --stat --summary side
190 # improved by Timo's patch
191 diff-tree
--cc --patch-with-stat master
192 # improved by Timo's patch
193 diff-tree
--cc --patch-with-stat --summary master
195 diff-tree
--cc --patch-with-stat --summary side
201 log
--patch-with-stat master
202 log
--root --patch-with-stat master
203 log
--root --patch-with-stat --summary master
204 # improved by Timo's patch
205 log
--root -c --patch-with-stat --summary master
206 # improved by Timo's patch
207 log
--root --cc --patch-with-stat --summary master
212 rev-list
--parents HEAD
213 rev-list
--children HEAD
216 whatchanged
-p master
217 whatchanged
--root master
218 whatchanged
--root -p master
219 whatchanged
--patch-with-stat master
220 whatchanged
--root --patch-with-stat master
221 whatchanged
--root --patch-with-stat --summary master
222 # improved by Timo's patch
223 whatchanged
--root -c --patch-with-stat --summary master
224 # improved by Timo's patch
225 whatchanged
--root --cc --patch-with-stat --summary master
226 whatchanged
-SF master
227 whatchanged
-SF -p master
229 log
--patch-with-stat master
-- dir
/
230 whatchanged
--patch-with-stat master
-- dir
/
231 log
--patch-with-stat --summary master
-- dir
/
232 whatchanged
--patch-with-stat --summary master
-- dir
/
239 show
--stat --summary side
240 show
--patch-with-stat side
241 show
--patch-with-raw side
242 show
--patch-with-stat --summary side
244 format-patch
--stdout initial..side
245 format-patch
--stdout initial..master^
246 format-patch
--stdout initial..master
247 format-patch
--stdout --no-numbered initial..master
248 format-patch
--stdout --numbered initial..master
249 format-patch
--attach --stdout initial..side
250 format-patch
--attach --stdout initial..master^
251 format-patch
--attach --stdout initial..master
252 format-patch
--inline --stdout initial..side
253 format-patch
--inline --stdout initial..master^
254 format-patch
--inline --stdout initial..master
255 format-patch
--inline --stdout initial..master
256 format-patch
--inline --stdout --subject-prefix=TESTCASE initial..master
257 config format.subjectprefix DIFFERENT_PREFIX
258 format-patch
--inline --stdout initial..master^^
259 format-patch
--stdout --cover-letter -n initial..master^
261 diff --abbrev initial..side
262 diff -r initial..side
263 diff --stat initial..side
264 diff -r --stat initial..side
266 diff --patch-with-stat initial..side
267 diff --patch-with-raw initial..side
268 diff --patch-with-stat -r initial..side
269 diff --patch-with-raw -r initial..side
270 diff --name-status dir2 dir
271 diff --no-index --name-status dir2 dir
272 diff --no-index --name-status -- dir2 dir
273 diff --no-index dir dir3
274 diff master master^ side
275 diff --dirstat master~
1 master~
2