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 &&
77 git config log.showroot false &&
84 * [master
] Merge branch
'side'
87 - [master
] Merge branch
'side'
93 V
=`git version | sed -e 's/^git version //' -e 's/\./\\./g'`
97 '' |
'#'*) continue ;;
99 test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
100 cnt
=`expr $test_count + 1`
101 pfx
=`printf "%04d" $cnt`
102 expect
="../t4013/diff.$test"
103 actual
="$pfx-diff.$test"
105 test_expect_success
"git $cmd" '
109 sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
110 -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
115 git diff "$expect" "$actual" &&
118 # this is to help developing new tests.
119 cp "$actual" "$expect"
126 diff-tree
-r --abbrev initial
127 diff-tree
-r --abbrev=4 initial
128 diff-tree
--root initial
129 diff-tree
--root --abbrev initial
130 diff-tree
--root -r initial
131 diff-tree
--root -r --abbrev initial
132 diff-tree
--root -r --abbrev=4 initial
134 diff-tree
--root -p initial
135 diff-tree
--patch-with-stat initial
136 diff-tree
--root --patch-with-stat initial
137 diff-tree
--patch-with-raw initial
138 diff-tree
--root --patch-with-raw initial
140 diff-tree
--pretty initial
141 diff-tree
--pretty --root initial
142 diff-tree
--pretty -p initial
143 diff-tree
--pretty --stat initial
144 diff-tree
--pretty --summary initial
145 diff-tree
--pretty --stat --summary initial
146 diff-tree
--pretty --root -p initial
147 diff-tree
--pretty --root --stat initial
148 # improved by Timo's patch
149 diff-tree
--pretty --root --summary initial
150 # improved by Timo's patch
151 diff-tree
--pretty --root --summary -r initial
152 diff-tree
--pretty --root --stat --summary initial
153 diff-tree
--pretty --patch-with-stat initial
154 diff-tree
--pretty --root --patch-with-stat initial
155 diff-tree
--pretty --patch-with-raw initial
156 diff-tree
--pretty --root --patch-with-raw initial
158 diff-tree
--pretty=oneline initial
159 diff-tree
--pretty=oneline
--root initial
160 diff-tree
--pretty=oneline
-p initial
161 diff-tree
--pretty=oneline
--root -p initial
162 diff-tree
--pretty=oneline
--patch-with-stat initial
163 # improved by Timo's patch
164 diff-tree
--pretty=oneline
--root --patch-with-stat initial
165 diff-tree
--pretty=oneline
--patch-with-raw initial
166 diff-tree
--pretty=oneline
--root --patch-with-raw initial
168 diff-tree
--pretty side
169 diff-tree
--pretty -p side
170 diff-tree
--pretty --patch-with-stat side
174 diff-tree
-p -m master
176 diff-tree
-c --abbrev master
177 diff-tree
--cc master
178 # stat only should show the diffstat with the first parent
179 diff-tree
-c --stat master
180 diff-tree
--cc --stat master
181 diff-tree
-c --stat --summary master
182 diff-tree
--cc --stat --summary master
183 # stat summary should show the diffstat and summary with the first parent
184 diff-tree
-c --stat --summary side
185 diff-tree
--cc --stat --summary side
186 # improved by Timo's patch
187 diff-tree
--cc --patch-with-stat master
188 # improved by Timo's patch
189 diff-tree
--cc --patch-with-stat --summary master
191 diff-tree
--cc --patch-with-stat --summary side
197 log
--patch-with-stat master
198 log
--root --patch-with-stat master
199 log
--root --patch-with-stat --summary master
200 # improved by Timo's patch
201 log
--root -c --patch-with-stat --summary master
202 # improved by Timo's patch
203 log
--root --cc --patch-with-stat --summary master
208 whatchanged
-p master
209 whatchanged
--root master
210 whatchanged
--root -p master
211 whatchanged
--patch-with-stat master
212 whatchanged
--root --patch-with-stat master
213 whatchanged
--root --patch-with-stat --summary master
214 # improved by Timo's patch
215 whatchanged
--root -c --patch-with-stat --summary master
216 # improved by Timo's patch
217 whatchanged
--root --cc --patch-with-stat --summary master
218 whatchanged
-SF master
219 whatchanged
-SF -p master
221 log
--patch-with-stat master
-- dir
/
222 whatchanged
--patch-with-stat master
-- dir
/
223 log
--patch-with-stat --summary master
-- dir
/
224 whatchanged
--patch-with-stat --summary master
-- dir
/
231 show
--stat --summary side
232 show
--patch-with-stat side
233 show
--patch-with-raw side
234 show
--patch-with-stat --summary side
236 format-patch
--stdout initial..side
237 format-patch
--stdout initial..master^
238 format-patch
--stdout initial..master
239 format-patch
--attach --stdout initial..side
240 format-patch
--attach --stdout initial..master^
241 format-patch
--attach --stdout initial..master
242 format-patch
--inline --stdout initial..side
243 format-patch
--inline --stdout initial..master^
244 format-patch
--inline --stdout initial..master
245 format-patch
--inline --stdout --subject-prefix=TESTCASE initial..master
246 config format.subjectprefix DIFFERENT_PREFIX
247 format-patch
--inline --stdout initial..master^^
248 format-patch
--stdout --cover-letter -n initial..master^
250 diff --abbrev initial..side
251 diff -r initial..side
252 diff --stat initial..side
253 diff -r --stat initial..side
255 diff --patch-with-stat initial..side
256 diff --patch-with-raw initial..side
257 diff --patch-with-stat -r initial..side
258 diff --patch-with-raw -r initial..side
259 diff --name-status dir2 dir