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 &&
20 for i in 1 2 3; do echo $i; done >file0 &&
21 for i in A B; do echo $i; done >dir/sub &&
23 git add file0 file2 dir/sub &&
24 git commit -m Initial &&
29 GIT_AUTHOR_DATE="2006-06-26 00:01:00 +0000" &&
30 GIT_COMMITTER_DATE="2006-06-26 00:01:00 +0000" &&
31 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
33 for i in 4 5 6; do echo $i; done >>file0 &&
34 for i in C D; do echo $i; done >>dir/sub &&
36 git update-index --remove file0 file2 dir/sub &&
37 git commit -m "Second${LF}${LF}This is the second commit." &&
39 GIT_AUTHOR_DATE="2006-06-26 00:02:00 +0000" &&
40 GIT_COMMITTER_DATE="2006-06-26 00:02:00 +0000" &&
41 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
43 for i in A B C; do echo $i; done >file1 &&
45 for i in E F; do echo $i; done >>dir/sub &&
46 git update-index dir/sub &&
47 git commit -m Third &&
49 GIT_AUTHOR_DATE="2006-06-26 00:03:00 +0000" &&
50 GIT_COMMITTER_DATE="2006-06-26 00:03:00 +0000" &&
51 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
54 for i in A B C; do echo $i; done >>file0 &&
55 for i in 1 2; do echo $i; done >>dir/sub &&
58 git update-index file0 dir/sub &&
61 GIT_AUTHOR_DATE="2006-06-26 00:04:00 +0000" &&
62 GIT_COMMITTER_DATE="2006-06-26 00:04:00 +0000" &&
63 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
65 git checkout master &&
66 git pull -s ours . side &&
68 GIT_AUTHOR_DATE="2006-06-26 00:05:00 +0000" &&
69 GIT_COMMITTER_DATE="2006-06-26 00:05:00 +0000" &&
70 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
72 for i in A B C; do echo $i; done >>file0 &&
73 for i in 1 2; do echo $i; done >>dir/sub &&
74 git update-index file0 dir/sub &&
82 * [master
] Merge branch
'side'
85 - [master
] Merge branch
'side'
91 V
=`git version | sed -e 's/^git version //' -e 's/\./\\./g'`
95 '' |
'#'*) continue ;;
97 test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
98 cnt
=`expr $test_count + 1`
99 pfx
=`printf "%04d" $cnt`
100 expect
="../t4013/diff.$test"
101 actual
="$pfx-diff.$test"
103 test_expect_success
"git $cmd" '
107 sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
108 -e "s/^\\( *boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
113 diff -u "$expect" "$actual" &&
116 # this is to help developing new tests.
117 cp "$actual" "$expect"
124 diff-tree
-r --abbrev initial
125 diff-tree
-r --abbrev=4 initial
126 diff-tree
--root initial
127 diff-tree
--root --abbrev initial
128 diff-tree
--root -r initial
129 diff-tree
--root -r --abbrev initial
130 diff-tree
--root -r --abbrev=4 initial
132 diff-tree
--root -p initial
133 diff-tree
--patch-with-stat initial
134 diff-tree
--root --patch-with-stat initial
135 diff-tree
--patch-with-raw initial
136 diff-tree
--root --patch-with-raw initial
138 diff-tree
--pretty initial
139 diff-tree
--pretty --root initial
140 diff-tree
--pretty -p initial
141 diff-tree
--pretty --stat initial
142 diff-tree
--pretty --summary initial
143 diff-tree
--pretty --stat --summary initial
144 diff-tree
--pretty --root -p initial
145 diff-tree
--pretty --root --stat initial
146 # improved by Timo's patch
147 diff-tree
--pretty --root --summary initial
148 # improved by Timo's patch
149 diff-tree
--pretty --root --summary -r initial
150 diff-tree
--pretty --root --stat --summary initial
151 diff-tree
--pretty --patch-with-stat initial
152 diff-tree
--pretty --root --patch-with-stat initial
153 diff-tree
--pretty --patch-with-raw initial
154 diff-tree
--pretty --root --patch-with-raw initial
156 diff-tree
--pretty=oneline initial
157 diff-tree
--pretty=oneline
--root initial
158 diff-tree
--pretty=oneline
-p initial
159 diff-tree
--pretty=oneline
--root -p initial
160 diff-tree
--pretty=oneline
--patch-with-stat initial
161 # improved by Timo's patch
162 diff-tree
--pretty=oneline
--root --patch-with-stat initial
163 diff-tree
--pretty=oneline
--patch-with-raw initial
164 diff-tree
--pretty=oneline
--root --patch-with-raw initial
166 diff-tree
--pretty side
167 diff-tree
--pretty -p side
168 diff-tree
--pretty --patch-with-stat side
172 diff-tree
-p -m master
174 diff-tree
-c --abbrev master
175 diff-tree
--cc master
176 # stat only should show the diffstat with the first parent
177 diff-tree
-c --stat master
178 diff-tree
--cc --stat master
179 diff-tree
-c --stat --summary master
180 diff-tree
--cc --stat --summary master
181 # stat summary should show the diffstat and summary with the first parent
182 diff-tree
-c --stat --summary side
183 diff-tree
--cc --stat --summary side
184 # improved by Timo's patch
185 diff-tree
--cc --patch-with-stat master
186 # improved by Timo's patch
187 diff-tree
--cc --patch-with-stat --summary master
189 diff-tree
--cc --patch-with-stat --summary side
195 log
--patch-with-stat master
196 log
--root --patch-with-stat master
197 log
--root --patch-with-stat --summary master
198 # improved by Timo's patch
199 log
--root -c --patch-with-stat --summary master
200 # improved by Timo's patch
201 log
--root --cc --patch-with-stat --summary master
206 whatchanged
-p master
207 whatchanged
--root master
208 whatchanged
--root -p master
209 whatchanged
--patch-with-stat master
210 whatchanged
--root --patch-with-stat master
211 whatchanged
--root --patch-with-stat --summary master
212 # improved by Timo's patch
213 whatchanged
--root -c --patch-with-stat --summary master
214 # improved by Timo's patch
215 whatchanged
--root --cc --patch-with-stat --summary master
216 whatchanged
-SF master
217 whatchanged
-SF -p master
219 log
--patch-with-stat master
-- dir
/
220 whatchanged
--patch-with-stat master
-- dir
/
221 log
--patch-with-stat --summary master
-- dir
/
222 whatchanged
--patch-with-stat --summary master
-- dir
/
229 show
--stat --summary side
230 show
--patch-with-stat side
231 show
--patch-with-raw side
232 show
--patch-with-stat --summary side
234 format-patch
--stdout initial..side
235 format-patch
--stdout initial..master^
236 format-patch
--stdout initial..master
237 format-patch
--attach --stdout initial..side
238 format-patch
--attach --stdout initial..master^
239 format-patch
--attach --stdout initial..master
241 diff --abbrev initial..side
242 diff -r initial..side
243 diff --stat initial..side
244 diff -r --stat initial..side
246 diff --patch-with-stat initial..side
247 diff --patch-with-raw initial..side
248 diff --patch-with-stat -r initial..side
249 diff --patch-with-raw -r initial..side