Blame


1 95adcdca 2019-03-27 stsp #!/bin/sh
2 95adcdca 2019-03-27 stsp #
3 95adcdca 2019-03-27 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 95adcdca 2019-03-27 stsp #
5 95adcdca 2019-03-27 stsp # Permission to use, copy, modify, and distribute this software for any
6 95adcdca 2019-03-27 stsp # purpose with or without fee is hereby granted, provided that the above
7 95adcdca 2019-03-27 stsp # copyright notice and this permission notice appear in all copies.
8 95adcdca 2019-03-27 stsp #
9 95adcdca 2019-03-27 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 95adcdca 2019-03-27 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 95adcdca 2019-03-27 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 95adcdca 2019-03-27 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 95adcdca 2019-03-27 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 95adcdca 2019-03-27 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 95adcdca 2019-03-27 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 95adcdca 2019-03-27 stsp
17 95adcdca 2019-03-27 stsp . ./common.sh
18 95adcdca 2019-03-27 stsp
19 f6cae3ed 2020-09-13 naddy test_diff_basic() {
20 95adcdca 2019-03-27 stsp local testroot=`test_init diff_basic`
21 95adcdca 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
22 4ad4d490 2022-08-30 thomas local alpha_blobid=`get_blob_id $testroot/repo "" alpha`
23 95adcdca 2019-03-27 stsp
24 95adcdca 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
25 fc414659 2022-04-16 thomas ret=$?
26 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
27 95adcdca 2019-03-27 stsp test_done "$testroot" "$ret"
28 95adcdca 2019-03-27 stsp return 1
29 95adcdca 2019-03-27 stsp fi
30 95adcdca 2019-03-27 stsp
31 95adcdca 2019-03-27 stsp echo "modified alpha" > $testroot/wt/alpha
32 95adcdca 2019-03-27 stsp (cd $testroot/wt && got rm beta >/dev/null)
33 95adcdca 2019-03-27 stsp echo "new file" > $testroot/wt/new
34 95adcdca 2019-03-27 stsp (cd $testroot/wt && got add new >/dev/null)
35 95adcdca 2019-03-27 stsp
36 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
37 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
38 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
39 95adcdca 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
40 95adcdca 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
41 95adcdca 2019-03-27 stsp >> $testroot/stdout.expected
42 95adcdca 2019-03-27 stsp echo 'file + alpha' >> $testroot/stdout.expected
43 95adcdca 2019-03-27 stsp echo '--- alpha' >> $testroot/stdout.expected
44 95adcdca 2019-03-27 stsp echo '+++ alpha' >> $testroot/stdout.expected
45 95adcdca 2019-03-27 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
46 95adcdca 2019-03-27 stsp echo '-alpha' >> $testroot/stdout.expected
47 95adcdca 2019-03-27 stsp echo '+modified alpha' >> $testroot/stdout.expected
48 95adcdca 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
49 95adcdca 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
50 95adcdca 2019-03-27 stsp >> $testroot/stdout.expected
51 95adcdca 2019-03-27 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
52 95adcdca 2019-03-27 stsp echo '--- beta' >> $testroot/stdout.expected
53 1cb46f00 2020-11-21 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
54 95adcdca 2019-03-27 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
55 95adcdca 2019-03-27 stsp echo '-beta' >> $testroot/stdout.expected
56 95adcdca 2019-03-27 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
57 6d054bb9 2022-09-23 thomas echo 'file + new (mode 644)' >> $testroot/stdout.expected
58 1cb46f00 2020-11-21 stsp echo '--- /dev/null' >> $testroot/stdout.expected
59 95adcdca 2019-03-27 stsp echo '+++ new' >> $testroot/stdout.expected
60 95adcdca 2019-03-27 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
61 95adcdca 2019-03-27 stsp echo '+new file' >> $testroot/stdout.expected
62 95adcdca 2019-03-27 stsp
63 95adcdca 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
64 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
65 fc414659 2022-04-16 thomas ret=$?
66 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
67 95adcdca 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
68 2a06fe5f 2019-08-24 stsp test_done "$testroot" "$ret"
69 2a06fe5f 2019-08-24 stsp return 1
70 95adcdca 2019-03-27 stsp fi
71 2a06fe5f 2019-08-24 stsp
72 30f6c0c6 2021-10-08 thomas # 'got diff' in a repository without any arguments is an error
73 30f6c0c6 2021-10-08 thomas (cd $testroot/repo && got diff 2> $testroot/stderr)
74 ad10f64e 2023-07-19 thomas echo "got: no work tree found" > $testroot/stderr.expected
75 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stderr.expected $testroot/stderr
76 fc414659 2022-04-16 thomas ret=$?
77 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
78 30f6c0c6 2021-10-08 thomas diff -u $testroot/stderr.expected $testroot/stderr
79 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
80 30f6c0c6 2021-10-08 thomas return 1
81 30f6c0c6 2021-10-08 thomas fi
82 30f6c0c6 2021-10-08 thomas
83 30f6c0c6 2021-10-08 thomas # 'got diff' in a repository with two arguments requires that
84 30f6c0c6 2021-10-08 thomas # both named objects exist
85 30f6c0c6 2021-10-08 thomas (cd $testroot/repo && got diff $head_rev foo 2> $testroot/stderr)
86 30f6c0c6 2021-10-08 thomas echo "got: foo: object not found" > $testroot/stderr.expected
87 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stderr.expected $testroot/stderr
88 fc414659 2022-04-16 thomas ret=$?
89 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
90 30f6c0c6 2021-10-08 thomas diff -u $testroot/stderr.expected $testroot/stderr
91 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
92 30f6c0c6 2021-10-08 thomas return 1
93 30f6c0c6 2021-10-08 thomas fi
94 30f6c0c6 2021-10-08 thomas
95 2a06fe5f 2019-08-24 stsp # diff non-existent path
96 2a06fe5f 2019-08-24 stsp (cd $testroot/wt && got diff nonexistent > $testroot/stdout \
97 2a06fe5f 2019-08-24 stsp 2> $testroot/stderr)
98 2a06fe5f 2019-08-24 stsp
99 2a06fe5f 2019-08-24 stsp echo -n > $testroot/stdout.expected
100 2a06fe5f 2019-08-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
101 fc414659 2022-04-16 thomas ret=$?
102 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
103 2a06fe5f 2019-08-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
104 2a06fe5f 2019-08-24 stsp test_done "$testroot" "$ret"
105 2a06fe5f 2019-08-24 stsp return 1
106 2a06fe5f 2019-08-24 stsp fi
107 2a06fe5f 2019-08-24 stsp
108 2a06fe5f 2019-08-24 stsp echo "got: nonexistent: No such file or directory" \
109 30f6c0c6 2021-10-08 thomas > $testroot/stderr.expected
110 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stderr.expected $testroot/stderr
111 fc414659 2022-04-16 thomas ret=$?
112 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
113 30f6c0c6 2021-10-08 thomas diff -u $testroot/stderr.expected $testroot/stderr
114 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
115 30f6c0c6 2021-10-08 thomas return 1
116 30f6c0c6 2021-10-08 thomas fi
117 30f6c0c6 2021-10-08 thomas
118 30f6c0c6 2021-10-08 thomas echo "modified zeta" > $testroot/wt/epsilon/zeta
119 30f6c0c6 2021-10-08 thomas
120 30f6c0c6 2021-10-08 thomas # diff several paths in a work tree
121 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
122 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
123 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
124 30f6c0c6 2021-10-08 thomas echo -n 'blob - ' >> $testroot/stdout.expected
125 30f6c0c6 2021-10-08 thomas got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
126 30f6c0c6 2021-10-08 thomas >> $testroot/stdout.expected
127 30f6c0c6 2021-10-08 thomas echo 'file + alpha' >> $testroot/stdout.expected
128 30f6c0c6 2021-10-08 thomas echo '--- alpha' >> $testroot/stdout.expected
129 30f6c0c6 2021-10-08 thomas echo '+++ alpha' >> $testroot/stdout.expected
130 30f6c0c6 2021-10-08 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
131 30f6c0c6 2021-10-08 thomas echo '-alpha' >> $testroot/stdout.expected
132 30f6c0c6 2021-10-08 thomas echo '+modified alpha' >> $testroot/stdout.expected
133 30f6c0c6 2021-10-08 thomas echo -n 'blob - ' >> $testroot/stdout.expected
134 f1417e9f 2021-10-12 thomas got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
135 f1417e9f 2021-10-12 thomas >> $testroot/stdout.expected
136 f1417e9f 2021-10-12 thomas echo 'file + /dev/null' >> $testroot/stdout.expected
137 f1417e9f 2021-10-12 thomas echo '--- beta' >> $testroot/stdout.expected
138 f1417e9f 2021-10-12 thomas echo '+++ /dev/null' >> $testroot/stdout.expected
139 f1417e9f 2021-10-12 thomas echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
140 f1417e9f 2021-10-12 thomas echo '-beta' >> $testroot/stdout.expected
141 f1417e9f 2021-10-12 thomas echo -n 'blob - ' >> $testroot/stdout.expected
142 30f6c0c6 2021-10-08 thomas got tree -r $testroot/repo -i epsilon | grep 'zeta$' | cut -d' ' -f 1 \
143 30f6c0c6 2021-10-08 thomas >> $testroot/stdout.expected
144 30f6c0c6 2021-10-08 thomas echo 'file + epsilon/zeta' >> $testroot/stdout.expected
145 30f6c0c6 2021-10-08 thomas echo '--- epsilon/zeta' >> $testroot/stdout.expected
146 30f6c0c6 2021-10-08 thomas echo '+++ epsilon/zeta' >> $testroot/stdout.expected
147 30f6c0c6 2021-10-08 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
148 30f6c0c6 2021-10-08 thomas echo '-zeta' >> $testroot/stdout.expected
149 30f6c0c6 2021-10-08 thomas echo '+modified zeta' >> $testroot/stdout.expected
150 f1417e9f 2021-10-12 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
151 6d054bb9 2022-09-23 thomas echo 'file + new (mode 644)' >> $testroot/stdout.expected
152 f1417e9f 2021-10-12 thomas echo '--- /dev/null' >> $testroot/stdout.expected
153 f1417e9f 2021-10-12 thomas echo '+++ new' >> $testroot/stdout.expected
154 f1417e9f 2021-10-12 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
155 f1417e9f 2021-10-12 thomas echo '+new file' >> $testroot/stdout.expected
156 30f6c0c6 2021-10-08 thomas
157 30f6c0c6 2021-10-08 thomas (cd $testroot/wt && got diff new alpha epsilon beta > $testroot/stdout)
158 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
159 fc414659 2022-04-16 thomas ret=$?
160 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
161 30f6c0c6 2021-10-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
162 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
163 30f6c0c6 2021-10-08 thomas return 1
164 30f6c0c6 2021-10-08 thomas fi
165 30f6c0c6 2021-10-08 thomas
166 f1417e9f 2021-10-12 thomas # different order of arguments results in same output order
167 f1417e9f 2021-10-12 thomas (cd $testroot/wt && got diff alpha new epsilon beta \
168 30f6c0c6 2021-10-08 thomas > $testroot/stdout 2> $testroot/stderr)
169 fc414659 2022-04-16 thomas ret=$?
170 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
171 30f6c0c6 2021-10-08 thomas echo "diff failed unexpectedly" >&2
172 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
173 30f6c0c6 2021-10-08 thomas return 1
174 30f6c0c6 2021-10-08 thomas fi
175 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
176 fc414659 2022-04-16 thomas ret=$?
177 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
178 30f6c0c6 2021-10-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
179 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
180 30f6c0c6 2021-10-08 thomas return 1
181 30f6c0c6 2021-10-08 thomas fi
182 30f6c0c6 2021-10-08 thomas
183 f1417e9f 2021-10-12 thomas # a branch 'new' should not collide with path 'new' if more
184 f1417e9f 2021-10-12 thomas # than two arguments are passed
185 f1417e9f 2021-10-12 thomas got br -r $testroot/repo -c master new > /dev/null
186 f1417e9f 2021-10-12 thomas (cd $testroot/wt && got diff new alpha epsilon beta \
187 30f6c0c6 2021-10-08 thomas > $testroot/stdout 2> $testroot/stderr)
188 fc414659 2022-04-16 thomas ret=$?
189 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
190 30f6c0c6 2021-10-08 thomas echo "diff failed unexpectedly" >&2
191 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
192 30f6c0c6 2021-10-08 thomas return 1
193 30f6c0c6 2021-10-08 thomas fi
194 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
195 fc414659 2022-04-16 thomas ret=$?
196 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
197 30f6c0c6 2021-10-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
198 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
199 30f6c0c6 2021-10-08 thomas return 1
200 30f6c0c6 2021-10-08 thomas fi
201 30f6c0c6 2021-10-08 thomas
202 30f6c0c6 2021-10-08 thomas # Two arguments are interpreted as objects if a colliding path exists
203 30f6c0c6 2021-10-08 thomas echo master > $testroot/wt/master
204 30f6c0c6 2021-10-08 thomas (cd $testroot/wt && got add master > /dev/null)
205 30f6c0c6 2021-10-08 thomas (cd $testroot/wt && got diff master new > $testroot/stdout)
206 fc414659 2022-04-16 thomas ret=$?
207 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
208 30f6c0c6 2021-10-08 thomas echo "diff failed unexpectedly" >&2
209 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
210 30f6c0c6 2021-10-08 thomas return 1
211 30f6c0c6 2021-10-08 thomas fi
212 30f6c0c6 2021-10-08 thomas echo "diff refs/heads/master refs/heads/new" > $testroot/stdout.expected
213 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
214 9b4458b4 2022-06-26 thomas echo "commit + $head_rev" >> $testroot/stdout.expected
215 30f6c0c6 2021-10-08 thomas # diff between the branches is empty
216 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
217 fc414659 2022-04-16 thomas ret=$?
218 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
219 30f6c0c6 2021-10-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
220 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
221 30f6c0c6 2021-10-08 thomas return 1
222 30f6c0c6 2021-10-08 thomas fi
223 30f6c0c6 2021-10-08 thomas # same without a work tree
224 30f6c0c6 2021-10-08 thomas (cd $testroot/repo && got diff master new > $testroot/stdout)
225 fc414659 2022-04-16 thomas ret=$?
226 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
227 30f6c0c6 2021-10-08 thomas echo "diff failed unexpectedly" >&2
228 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
229 30f6c0c6 2021-10-08 thomas return 1
230 30f6c0c6 2021-10-08 thomas fi
231 30f6c0c6 2021-10-08 thomas echo "diff refs/heads/master refs/heads/new" > $testroot/stdout.expected
232 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
233 9b4458b4 2022-06-26 thomas echo "commit + $head_rev" >> $testroot/stdout.expected
234 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
235 fc414659 2022-04-16 thomas ret=$?
236 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
237 30f6c0c6 2021-10-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
238 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
239 30f6c0c6 2021-10-08 thomas return 1
240 30f6c0c6 2021-10-08 thomas fi
241 30f6c0c6 2021-10-08 thomas # same with -r argument
242 30f6c0c6 2021-10-08 thomas got diff -r $testroot/repo master new > $testroot/stdout
243 fc414659 2022-04-16 thomas ret=$?
244 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
245 30f6c0c6 2021-10-08 thomas echo "diff failed unexpectedly" >&2
246 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
247 30f6c0c6 2021-10-08 thomas return 1
248 30f6c0c6 2021-10-08 thomas fi
249 30f6c0c6 2021-10-08 thomas echo "diff refs/heads/master refs/heads/new" > $testroot/stdout.expected
250 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
251 9b4458b4 2022-06-26 thomas echo "commit + $head_rev" >> $testroot/stdout.expected
252 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
253 fc414659 2022-04-16 thomas ret=$?
254 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
255 30f6c0c6 2021-10-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
256 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
257 30f6c0c6 2021-10-08 thomas return 1
258 30f6c0c6 2021-10-08 thomas fi
259 30f6c0c6 2021-10-08 thomas
260 30f6c0c6 2021-10-08 thomas # -P can be used to force use of paths
261 30f6c0c6 2021-10-08 thomas (cd $testroot/wt && got diff -P new master > $testroot/stdout)
262 fc414659 2022-04-16 thomas ret=$?
263 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
264 30f6c0c6 2021-10-08 thomas echo "diff failed unexpectedly" >&2
265 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
266 30f6c0c6 2021-10-08 thomas return 1
267 30f6c0c6 2021-10-08 thomas fi
268 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
269 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
270 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
271 30f6c0c6 2021-10-08 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
272 6d054bb9 2022-09-23 thomas echo 'file + master (mode 644)' >> $testroot/stdout.expected
273 30f6c0c6 2021-10-08 thomas echo '--- /dev/null' >> $testroot/stdout.expected
274 30f6c0c6 2021-10-08 thomas echo '+++ master' >> $testroot/stdout.expected
275 30f6c0c6 2021-10-08 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
276 30f6c0c6 2021-10-08 thomas echo '+master' >> $testroot/stdout.expected
277 f1417e9f 2021-10-12 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
278 6d054bb9 2022-09-23 thomas echo 'file + new (mode 644)' >> $testroot/stdout.expected
279 f1417e9f 2021-10-12 thomas echo '--- /dev/null' >> $testroot/stdout.expected
280 f1417e9f 2021-10-12 thomas echo '+++ new' >> $testroot/stdout.expected
281 f1417e9f 2021-10-12 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
282 f1417e9f 2021-10-12 thomas echo '+new file' >> $testroot/stdout.expected
283 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
284 fc414659 2022-04-16 thomas ret=$?
285 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
286 30f6c0c6 2021-10-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
287 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
288 30f6c0c6 2021-10-08 thomas return 1
289 30f6c0c6 2021-10-08 thomas fi
290 30f6c0c6 2021-10-08 thomas
291 30f6c0c6 2021-10-08 thomas # -P can only be used in a work tree
292 30f6c0c6 2021-10-08 thomas got diff -r $testroot/repo -P new master 2> $testroot/stderr
293 fc414659 2022-04-16 thomas ret=$?
294 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
295 30f6c0c6 2021-10-08 thomas echo "diff succeeded unexpectedly" >&2
296 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
297 30f6c0c6 2021-10-08 thomas return 1
298 30f6c0c6 2021-10-08 thomas fi
299 30f6c0c6 2021-10-08 thomas echo "got: -P option can only be used when diffing a work tree" \
300 2a06fe5f 2019-08-24 stsp > $testroot/stderr.expected
301 2a06fe5f 2019-08-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
302 fc414659 2022-04-16 thomas ret=$?
303 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
304 2a06fe5f 2019-08-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
305 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
306 30f6c0c6 2021-10-08 thomas return 1
307 30f6c0c6 2021-10-08 thomas fi
308 30f6c0c6 2021-10-08 thomas
309 30f6c0c6 2021-10-08 thomas # a single argument which can be resolved to a path is not ambiguous
310 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
311 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
312 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
313 30f6c0c6 2021-10-08 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
314 6d054bb9 2022-09-23 thomas echo 'file + new (mode 644)' >> $testroot/stdout.expected
315 30f6c0c6 2021-10-08 thomas echo '--- /dev/null' >> $testroot/stdout.expected
316 30f6c0c6 2021-10-08 thomas echo '+++ new' >> $testroot/stdout.expected
317 30f6c0c6 2021-10-08 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
318 30f6c0c6 2021-10-08 thomas echo '+new file' >> $testroot/stdout.expected
319 30f6c0c6 2021-10-08 thomas (cd $testroot/wt && got diff new > $testroot/stdout)
320 fc414659 2022-04-16 thomas ret=$?
321 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
322 30f6c0c6 2021-10-08 thomas echo "diff failed unexpectedly" >&2
323 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
324 30f6c0c6 2021-10-08 thomas return 1
325 30f6c0c6 2021-10-08 thomas fi
326 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
327 fc414659 2022-04-16 thomas ret=$?
328 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
329 30f6c0c6 2021-10-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
330 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
331 30f6c0c6 2021-10-08 thomas return 1
332 30f6c0c6 2021-10-08 thomas fi
333 30f6c0c6 2021-10-08 thomas
334 30f6c0c6 2021-10-08 thomas # diff with just one object ID argument results in
335 30f6c0c6 2021-10-08 thomas # interpretation of argument as a path
336 30f6c0c6 2021-10-08 thomas (cd $testroot/wt && got diff $head_rev 2> $testroot/stderr)
337 fc414659 2022-04-16 thomas ret=$?
338 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
339 30f6c0c6 2021-10-08 thomas echo "diff succeeded unexpectedly" >&2
340 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
341 30f6c0c6 2021-10-08 thomas return 1
342 30f6c0c6 2021-10-08 thomas fi
343 30f6c0c6 2021-10-08 thomas echo "got: $head_rev: No such file or directory" \
344 30f6c0c6 2021-10-08 thomas > $testroot/stderr.expected
345 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stderr.expected $testroot/stderr
346 fc414659 2022-04-16 thomas ret=$?
347 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
348 30f6c0c6 2021-10-08 thomas diff -u $testroot/stderr.expected $testroot/stderr
349 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
350 30f6c0c6 2021-10-08 thomas return 1
351 30f6c0c6 2021-10-08 thomas fi
352 30f6c0c6 2021-10-08 thomas
353 30f6c0c6 2021-10-08 thomas # diff with more than two object arguments results in
354 30f6c0c6 2021-10-08 thomas # interpretation of arguments as paths
355 30f6c0c6 2021-10-08 thomas (cd $testroot/wt && got diff new $head_rev master \
356 30f6c0c6 2021-10-08 thomas > $testroot/stout 2> $testroot/stderr)
357 fc414659 2022-04-16 thomas ret=$?
358 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
359 30f6c0c6 2021-10-08 thomas echo "diff succeeded unexpectedly" >&2
360 30f6c0c6 2021-10-08 thomas test_done "$testroot" "1"
361 30f6c0c6 2021-10-08 thomas return 1
362 30f6c0c6 2021-10-08 thomas fi
363 30f6c0c6 2021-10-08 thomas
364 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
365 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
366 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
367 30f6c0c6 2021-10-08 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
368 6d054bb9 2022-09-23 thomas echo 'file + new (mode 644)' >> $testroot/stdout.expected
369 30f6c0c6 2021-10-08 thomas echo '--- /dev/null' >> $testroot/stdout.expected
370 30f6c0c6 2021-10-08 thomas echo '+++ new' >> $testroot/stdout.expected
371 30f6c0c6 2021-10-08 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
372 30f6c0c6 2021-10-08 thomas echo '+new file' >> $testroot/stdout.expected
373 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
374 fc414659 2022-04-16 thomas ret=$?
375 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
376 30f6c0c6 2021-10-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
377 30f6c0c6 2021-10-08 thomas test_done "$testroot" "$ret"
378 30f6c0c6 2021-10-08 thomas return 1
379 30f6c0c6 2021-10-08 thomas fi
380 30f6c0c6 2021-10-08 thomas
381 30f6c0c6 2021-10-08 thomas echo "got: $head_rev: No such file or directory" \
382 30f6c0c6 2021-10-08 thomas > $testroot/stderr.expected
383 30f6c0c6 2021-10-08 thomas cmp -s $testroot/stderr.expected $testroot/stderr
384 fc414659 2022-04-16 thomas ret=$?
385 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
386 30f6c0c6 2021-10-08 thomas diff -u $testroot/stderr.expected $testroot/stderr
387 4ad4d490 2022-08-30 thomas return 1
388 4ad4d490 2022-08-30 thomas fi
389 4ad4d490 2022-08-30 thomas
390 4ad4d490 2022-08-30 thomas # diff two blob ids
391 4ad4d490 2022-08-30 thomas (cd $testroot/wt && got commit -m 'edit' alpha >/dev/null)
392 4ad4d490 2022-08-30 thomas local alpha_new_blobid=`get_blob_id $testroot/repo "" alpha`
393 3870c091 2022-08-31 thomas (cd $testroot/wt && got diff $alpha_blobid $alpha_new_blobid) \
394 3870c091 2022-08-31 thomas > $testroot/diff
395 4ad4d490 2022-08-30 thomas ret=$?
396 4ad4d490 2022-08-30 thomas if [ $ret -ne 0 ]; then
397 4ad4d490 2022-08-30 thomas echo "diff failed unexpectedly" >&2
398 4ad4d490 2022-08-30 thomas test_done "$testroot" "$ret"
399 4ad4d490 2022-08-30 thomas return 1
400 4ad4d490 2022-08-30 thomas fi
401 4ad4d490 2022-08-30 thomas
402 4ad4d490 2022-08-30 thomas cat <<EOF >$testroot/diff.expected
403 4ad4d490 2022-08-30 thomas blob - $alpha_blobid
404 4ad4d490 2022-08-30 thomas blob + $alpha_new_blobid
405 4ad4d490 2022-08-30 thomas --- $alpha_blobid
406 4ad4d490 2022-08-30 thomas +++ $alpha_new_blobid
407 4ad4d490 2022-08-30 thomas @@ -1 +1 @@
408 4ad4d490 2022-08-30 thomas -alpha
409 4ad4d490 2022-08-30 thomas +modified alpha
410 4ad4d490 2022-08-30 thomas EOF
411 4ad4d490 2022-08-30 thomas
412 4ad4d490 2022-08-30 thomas cmp -s $testroot/diff.expected $testroot/diff
413 4ad4d490 2022-08-30 thomas ret=$?
414 4ad4d490 2022-08-30 thomas if [ $ret -ne 0 ]; then
415 4ad4d490 2022-08-30 thomas echo
416 4ad4d490 2022-08-30 thomas diff -u $testroot/diff.expected $testroot/diff
417 4ad4d490 2022-08-30 thomas test_done "$testroot" "$ret"
418 30f6c0c6 2021-10-08 thomas return 1
419 2a06fe5f 2019-08-24 stsp fi
420 4ad4d490 2022-08-30 thomas
421 95adcdca 2019-03-27 stsp test_done "$testroot" "$ret"
422 95adcdca 2019-03-27 stsp }
423 95adcdca 2019-03-27 stsp
424 f6cae3ed 2020-09-13 naddy test_diff_shows_conflict() {
425 95adcdca 2019-03-27 stsp local testroot=`test_init diff_shows_conflict 1`
426 95adcdca 2019-03-27 stsp
427 95adcdca 2019-03-27 stsp echo "1" > $testroot/repo/numbers
428 95adcdca 2019-03-27 stsp echo "2" >> $testroot/repo/numbers
429 95adcdca 2019-03-27 stsp echo "3" >> $testroot/repo/numbers
430 95adcdca 2019-03-27 stsp echo "4" >> $testroot/repo/numbers
431 95adcdca 2019-03-27 stsp echo "5" >> $testroot/repo/numbers
432 95adcdca 2019-03-27 stsp echo "6" >> $testroot/repo/numbers
433 95adcdca 2019-03-27 stsp echo "7" >> $testroot/repo/numbers
434 95adcdca 2019-03-27 stsp echo "8" >> $testroot/repo/numbers
435 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add numbers
436 95adcdca 2019-03-27 stsp git_commit $testroot/repo -m "added numbers file"
437 f69721c3 2019-10-21 stsp local base_commit=`git_show_head $testroot/repo`
438 95adcdca 2019-03-27 stsp
439 95adcdca 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
440 fc414659 2022-04-16 thomas ret=$?
441 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
442 95adcdca 2019-03-27 stsp test_done "$testroot" "$ret"
443 95adcdca 2019-03-27 stsp return 1
444 95adcdca 2019-03-27 stsp fi
445 95adcdca 2019-03-27 stsp
446 ac3cdf31 2023-03-06 thomas ed -s $testroot/repo/numbers <<-\EOF
447 ac3cdf31 2023-03-06 thomas ,s/2/22/
448 ac3cdf31 2023-03-06 thomas ,s/8/33/
449 ac3cdf31 2023-03-06 thomas w
450 ac3cdf31 2023-03-06 thomas EOF
451 95adcdca 2019-03-27 stsp git_commit $testroot/repo -m "modified line 2"
452 95adcdca 2019-03-27 stsp local head_rev=`git_show_head $testroot/repo`
453 95adcdca 2019-03-27 stsp
454 d136cfcb 2019-10-12 stsp # modify lines 2 and 8 in conflicting ways
455 ac3cdf31 2023-03-06 thomas ed -s $testroot/wt/numbers <<-\EOF
456 ac3cdf31 2023-03-06 thomas ,s/2/77/
457 ac3cdf31 2023-03-06 thomas ,s/8/88/
458 ac3cdf31 2023-03-06 thomas w
459 ac3cdf31 2023-03-06 thomas EOF
460 95adcdca 2019-03-27 stsp
461 95adcdca 2019-03-27 stsp echo "C numbers" > $testroot/stdout.expected
462 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: $head_rev" \
463 4f3c844b 2021-09-14 stsp >> $testroot/stdout.expected
464 95adcdca 2019-03-27 stsp echo >> $testroot/stdout.expected
465 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
466 95adcdca 2019-03-27 stsp
467 95adcdca 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
468 95adcdca 2019-03-27 stsp
469 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
470 fc414659 2022-04-16 thomas ret=$?
471 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
472 95adcdca 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
473 95adcdca 2019-03-27 stsp test_done "$testroot" "$ret"
474 95adcdca 2019-03-27 stsp return 1
475 95adcdca 2019-03-27 stsp fi
476 95adcdca 2019-03-27 stsp
477 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
478 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
479 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
480 95adcdca 2019-03-27 stsp echo -n 'blob - ' >> $testroot/stdout.expected
481 95adcdca 2019-03-27 stsp got tree -r $testroot/repo -i | grep 'numbers$' | cut -d' ' -f 1 \
482 95adcdca 2019-03-27 stsp >> $testroot/stdout.expected
483 95adcdca 2019-03-27 stsp echo 'file + numbers' >> $testroot/stdout.expected
484 95adcdca 2019-03-27 stsp echo '--- numbers' >> $testroot/stdout.expected
485 95adcdca 2019-03-27 stsp echo '+++ numbers' >> $testroot/stdout.expected
486 d136cfcb 2019-10-12 stsp echo '@@ -1,8 +1,20 @@' >> $testroot/stdout.expected
487 95adcdca 2019-03-27 stsp echo ' 1' >> $testroot/stdout.expected
488 f69721c3 2019-10-21 stsp echo "+<<<<<<< merged change: commit $head_rev" \
489 f69721c3 2019-10-21 stsp >> $testroot/stdout.expected
490 95adcdca 2019-03-27 stsp echo ' 22' >> $testroot/stdout.expected
491 f69721c3 2019-10-21 stsp echo "+||||||| 3-way merge base: commit $base_commit" \
492 f69721c3 2019-10-21 stsp >> $testroot/stdout.expected
493 d136cfcb 2019-10-12 stsp echo '+2' >> $testroot/stdout.expected
494 95adcdca 2019-03-27 stsp echo '+=======' >> $testroot/stdout.expected
495 95adcdca 2019-03-27 stsp echo '+77' >> $testroot/stdout.expected
496 f69721c3 2019-10-21 stsp echo '+>>>>>>>' >> $testroot/stdout.expected
497 95adcdca 2019-03-27 stsp echo ' 3' >> $testroot/stdout.expected
498 95adcdca 2019-03-27 stsp echo ' 4' >> $testroot/stdout.expected
499 95adcdca 2019-03-27 stsp echo ' 5' >> $testroot/stdout.expected
500 d136cfcb 2019-10-12 stsp echo ' 6' >> $testroot/stdout.expected
501 d136cfcb 2019-10-12 stsp echo ' 7' >> $testroot/stdout.expected
502 f69721c3 2019-10-21 stsp echo "+<<<<<<< merged change: commit $head_rev" \
503 f69721c3 2019-10-21 stsp >> $testroot/stdout.expected
504 d136cfcb 2019-10-12 stsp echo ' 33' >> $testroot/stdout.expected
505 f69721c3 2019-10-21 stsp echo "+||||||| 3-way merge base: commit $base_commit" \
506 f69721c3 2019-10-21 stsp >> $testroot/stdout.expected
507 d136cfcb 2019-10-12 stsp echo '+8' >> $testroot/stdout.expected
508 d136cfcb 2019-10-12 stsp echo '+=======' >> $testroot/stdout.expected
509 d136cfcb 2019-10-12 stsp echo '+88' >> $testroot/stdout.expected
510 f69721c3 2019-10-21 stsp echo '+>>>>>>>' >> $testroot/stdout.expected
511 95adcdca 2019-03-27 stsp
512 95adcdca 2019-03-27 stsp (cd $testroot/wt && got diff > $testroot/stdout)
513 95adcdca 2019-03-27 stsp
514 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
515 fc414659 2022-04-16 thomas ret=$?
516 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
517 95adcdca 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
518 95adcdca 2019-03-27 stsp fi
519 95adcdca 2019-03-27 stsp test_done "$testroot" "$ret"
520 95adcdca 2019-03-27 stsp }
521 95adcdca 2019-03-27 stsp
522 f6cae3ed 2020-09-13 naddy test_diff_tag() {
523 d24820bf 2019-08-11 stsp local testroot=`test_init diff_tag`
524 d24820bf 2019-08-11 stsp local commit_id0=`git_show_head $testroot/repo`
525 d24820bf 2019-08-11 stsp local tag1=1.0.0
526 d24820bf 2019-08-11 stsp local tag2=2.0.0
527 d24820bf 2019-08-11 stsp
528 d24820bf 2019-08-11 stsp echo "modified alpha" > $testroot/repo/alpha
529 d24820bf 2019-08-11 stsp git_commit $testroot/repo -m "changed alpha"
530 d24820bf 2019-08-11 stsp local commit_id1=`git_show_head $testroot/repo`
531 d24820bf 2019-08-11 stsp
532 d1e03b8c 2023-10-08 thomas git -C $testroot/repo tag -m "test" $tag1
533 d24820bf 2019-08-11 stsp
534 d24820bf 2019-08-11 stsp echo "new file" > $testroot/repo/new
535 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add new
536 d24820bf 2019-08-11 stsp git_commit $testroot/repo -m "new file"
537 d24820bf 2019-08-11 stsp local commit_id2=`git_show_head $testroot/repo`
538 d24820bf 2019-08-11 stsp
539 d1e03b8c 2023-10-08 thomas git -C $testroot/repo tag -m "test" $tag2
540 562580bc 2020-01-14 stsp
541 562580bc 2020-01-14 stsp echo "diff $commit_id0 refs/tags/$tag1" > $testroot/stdout.expected
542 9b4458b4 2022-06-26 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
543 9b4458b4 2022-06-26 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
544 562580bc 2020-01-14 stsp echo -n 'blob - ' >> $testroot/stdout.expected
545 562580bc 2020-01-14 stsp got tree -r $testroot/repo -c $commit_id0 -i | grep 'alpha$' | \
546 562580bc 2020-01-14 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
547 562580bc 2020-01-14 stsp echo -n 'blob + ' >> $testroot/stdout.expected
548 562580bc 2020-01-14 stsp got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
549 562580bc 2020-01-14 stsp >> $testroot/stdout.expected
550 562580bc 2020-01-14 stsp echo '--- alpha' >> $testroot/stdout.expected
551 562580bc 2020-01-14 stsp echo '+++ alpha' >> $testroot/stdout.expected
552 562580bc 2020-01-14 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
553 562580bc 2020-01-14 stsp echo '-alpha' >> $testroot/stdout.expected
554 562580bc 2020-01-14 stsp echo '+modified alpha' >> $testroot/stdout.expected
555 562580bc 2020-01-14 stsp
556 562580bc 2020-01-14 stsp got diff -r $testroot/repo $commit_id0 $tag1 > $testroot/stdout
557 562580bc 2020-01-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
558 fc414659 2022-04-16 thomas ret=$?
559 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
560 562580bc 2020-01-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
561 562580bc 2020-01-14 stsp test_done "$testroot" "$ret"
562 562580bc 2020-01-14 stsp return 1
563 562580bc 2020-01-14 stsp fi
564 562580bc 2020-01-14 stsp
565 562580bc 2020-01-14 stsp echo "diff refs/tags/$tag1 refs/tags/$tag2" > $testroot/stdout.expected
566 9b4458b4 2022-06-26 thomas echo "commit - $commit_id1" >> $testroot/stdout.expected
567 9b4458b4 2022-06-26 thomas echo "commit + $commit_id2" >> $testroot/stdout.expected
568 562580bc 2020-01-14 stsp echo "blob - /dev/null" >> $testroot/stdout.expected
569 562580bc 2020-01-14 stsp echo -n 'blob + ' >> $testroot/stdout.expected
570 562580bc 2020-01-14 stsp got tree -r $testroot/repo -i -c $commit_id2 | grep 'new$' | \
571 562580bc 2020-01-14 stsp cut -d' ' -f 1 | tr -d '\n' >> $testroot/stdout.expected
572 562580bc 2020-01-14 stsp echo " (mode 644)" >> $testroot/stdout.expected
573 562580bc 2020-01-14 stsp echo '--- /dev/null' >> $testroot/stdout.expected
574 562580bc 2020-01-14 stsp echo '+++ new' >> $testroot/stdout.expected
575 562580bc 2020-01-14 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
576 562580bc 2020-01-14 stsp echo '+new file' >> $testroot/stdout.expected
577 d24820bf 2019-08-11 stsp
578 562580bc 2020-01-14 stsp got diff -r $testroot/repo $tag1 $tag2 > $testroot/stdout
579 562580bc 2020-01-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
580 fc414659 2022-04-16 thomas ret=$?
581 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
582 562580bc 2020-01-14 stsp diff -u $testroot/stdout.expected $testroot/stdout
583 562580bc 2020-01-14 stsp fi
584 562580bc 2020-01-14 stsp test_done "$testroot" "$ret"
585 562580bc 2020-01-14 stsp }
586 562580bc 2020-01-14 stsp
587 f6cae3ed 2020-09-13 naddy test_diff_lightweight_tag() {
588 562580bc 2020-01-14 stsp local testroot=`test_init diff_tag`
589 562580bc 2020-01-14 stsp local commit_id0=`git_show_head $testroot/repo`
590 562580bc 2020-01-14 stsp local tag1=1.0.0
591 562580bc 2020-01-14 stsp local tag2=2.0.0
592 562580bc 2020-01-14 stsp
593 562580bc 2020-01-14 stsp echo "modified alpha" > $testroot/repo/alpha
594 562580bc 2020-01-14 stsp git_commit $testroot/repo -m "changed alpha"
595 562580bc 2020-01-14 stsp local commit_id1=`git_show_head $testroot/repo`
596 562580bc 2020-01-14 stsp
597 d1e03b8c 2023-10-08 thomas git -C $testroot/repo tag $tag1
598 562580bc 2020-01-14 stsp
599 562580bc 2020-01-14 stsp echo "new file" > $testroot/repo/new
600 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add new
601 562580bc 2020-01-14 stsp git_commit $testroot/repo -m "new file"
602 562580bc 2020-01-14 stsp local commit_id2=`git_show_head $testroot/repo`
603 562580bc 2020-01-14 stsp
604 d1e03b8c 2023-10-08 thomas git -C $testroot/repo tag $tag2
605 562580bc 2020-01-14 stsp
606 d24820bf 2019-08-11 stsp echo "diff $commit_id0 refs/tags/$tag1" > $testroot/stdout.expected
607 9b4458b4 2022-06-26 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
608 9b4458b4 2022-06-26 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
609 d24820bf 2019-08-11 stsp echo -n 'blob - ' >> $testroot/stdout.expected
610 d24820bf 2019-08-11 stsp got tree -r $testroot/repo -c $commit_id0 -i | grep 'alpha$' | \
611 d24820bf 2019-08-11 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
612 d24820bf 2019-08-11 stsp echo -n 'blob + ' >> $testroot/stdout.expected
613 d24820bf 2019-08-11 stsp got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
614 d24820bf 2019-08-11 stsp >> $testroot/stdout.expected
615 d24820bf 2019-08-11 stsp echo '--- alpha' >> $testroot/stdout.expected
616 d24820bf 2019-08-11 stsp echo '+++ alpha' >> $testroot/stdout.expected
617 d24820bf 2019-08-11 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
618 d24820bf 2019-08-11 stsp echo '-alpha' >> $testroot/stdout.expected
619 d24820bf 2019-08-11 stsp echo '+modified alpha' >> $testroot/stdout.expected
620 d24820bf 2019-08-11 stsp
621 d24820bf 2019-08-11 stsp got diff -r $testroot/repo $commit_id0 $tag1 > $testroot/stdout
622 d24820bf 2019-08-11 stsp cmp -s $testroot/stdout.expected $testroot/stdout
623 fc414659 2022-04-16 thomas ret=$?
624 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
625 d24820bf 2019-08-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
626 d24820bf 2019-08-11 stsp test_done "$testroot" "$ret"
627 d24820bf 2019-08-11 stsp return 1
628 d24820bf 2019-08-11 stsp fi
629 d24820bf 2019-08-11 stsp
630 d24820bf 2019-08-11 stsp echo "diff refs/tags/$tag1 refs/tags/$tag2" > $testroot/stdout.expected
631 9b4458b4 2022-06-26 thomas echo "commit - $commit_id1" >> $testroot/stdout.expected
632 9b4458b4 2022-06-26 thomas echo "commit + $commit_id2" >> $testroot/stdout.expected
633 d24820bf 2019-08-11 stsp echo "blob - /dev/null" >> $testroot/stdout.expected
634 d24820bf 2019-08-11 stsp echo -n 'blob + ' >> $testroot/stdout.expected
635 d24820bf 2019-08-11 stsp got tree -r $testroot/repo -i -c $commit_id2 | grep 'new$' | \
636 46f68b20 2019-10-19 stsp cut -d' ' -f 1 | tr -d '\n' >> $testroot/stdout.expected
637 46f68b20 2019-10-19 stsp echo " (mode 644)" >> $testroot/stdout.expected
638 d24820bf 2019-08-11 stsp echo '--- /dev/null' >> $testroot/stdout.expected
639 d24820bf 2019-08-11 stsp echo '+++ new' >> $testroot/stdout.expected
640 d24820bf 2019-08-11 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
641 d24820bf 2019-08-11 stsp echo '+new file' >> $testroot/stdout.expected
642 d24820bf 2019-08-11 stsp
643 d24820bf 2019-08-11 stsp got diff -r $testroot/repo $tag1 $tag2 > $testroot/stdout
644 d24820bf 2019-08-11 stsp cmp -s $testroot/stdout.expected $testroot/stdout
645 fc414659 2022-04-16 thomas ret=$?
646 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
647 d24820bf 2019-08-11 stsp diff -u $testroot/stdout.expected $testroot/stdout
648 d24820bf 2019-08-11 stsp fi
649 d24820bf 2019-08-11 stsp test_done "$testroot" "$ret"
650 d24820bf 2019-08-11 stsp }
651 d24820bf 2019-08-11 stsp
652 f6cae3ed 2020-09-13 naddy test_diff_ignore_whitespace() {
653 63035f9f 2019-10-06 stsp local testroot=`test_init diff_ignore_whitespace`
654 63035f9f 2019-10-06 stsp local commit_id0=`git_show_head $testroot/repo`
655 63035f9f 2019-10-06 stsp
656 63035f9f 2019-10-06 stsp got checkout $testroot/repo $testroot/wt > /dev/null
657 fc414659 2022-04-16 thomas ret=$?
658 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
659 63035f9f 2019-10-06 stsp test_done "$testroot" "$ret"
660 63035f9f 2019-10-06 stsp return 1
661 63035f9f 2019-10-06 stsp fi
662 63035f9f 2019-10-06 stsp
663 63035f9f 2019-10-06 stsp echo "alpha " > $testroot/wt/alpha
664 63035f9f 2019-10-06 stsp
665 63035f9f 2019-10-06 stsp (cd $testroot/wt && got diff -w > $testroot/stdout)
666 63035f9f 2019-10-06 stsp
667 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
668 9b4458b4 2022-06-26 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
669 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
670 63035f9f 2019-10-06 stsp echo -n 'blob - ' >> $testroot/stdout.expected
671 63035f9f 2019-10-06 stsp got tree -r $testroot/repo -c $commit_id0 -i | grep 'alpha$' | \
672 63035f9f 2019-10-06 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
673 63035f9f 2019-10-06 stsp echo 'file + alpha' >> $testroot/stdout.expected
674 63035f9f 2019-10-06 stsp
675 63035f9f 2019-10-06 stsp cmp -s $testroot/stdout.expected $testroot/stdout
676 fc414659 2022-04-16 thomas ret=$?
677 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
678 63035f9f 2019-10-06 stsp diff -u $testroot/stdout.expected $testroot/stdout
679 e7303626 2020-05-14 stsp fi
680 e7303626 2020-05-14 stsp test_done "$testroot" "$ret"
681 e7303626 2020-05-14 stsp }
682 e7303626 2020-05-14 stsp
683 f6cae3ed 2020-09-13 naddy test_diff_submodule_of_same_repo() {
684 e7303626 2020-05-14 stsp local testroot=`test_init diff_submodule_of_same_repo`
685 e7303626 2020-05-14 stsp
686 d1e03b8c 2023-10-08 thomas git -C $testroot clone -q repo repo2 >/dev/null
687 d1e03b8c 2023-10-08 thomas git -C $testroot/repo -c protocol.file.allow=always \
688 d1e03b8c 2023-10-08 thomas submodule -q add ../repo2
689 d1e03b8c 2023-10-08 thomas git -C $testroot/repo commit -q -m 'adding submodule'
690 e7303626 2020-05-14 stsp
691 e7303626 2020-05-14 stsp epsilon_id=$(got tree -r $testroot/repo -i | grep 'epsilon/$' | \
692 e7303626 2020-05-14 stsp cut -d ' ' -f 1)
693 e7303626 2020-05-14 stsp submodule_id=$(got tree -r $testroot/repo -i | grep 'repo2\$$' | \
694 e7303626 2020-05-14 stsp cut -d ' ' -f 1)
695 e7303626 2020-05-14 stsp
696 e7303626 2020-05-14 stsp # Attempt a (nonsensical) diff between a tree object and a submodule.
697 e7303626 2020-05-14 stsp # Currently fails with "wrong type of object" error
698 e7303626 2020-05-14 stsp got diff -r $testroot/repo $epsilon_id $submodule_id \
699 e7303626 2020-05-14 stsp > $testroot/stdout 2> $testroot/stderr
700 fc414659 2022-04-16 thomas ret=$?
701 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
702 e7303626 2020-05-14 stsp echo "diff command succeeded unexpectedly" >&2
703 e7303626 2020-05-14 stsp test_done "$testroot" "1"
704 e7303626 2020-05-14 stsp return 1
705 63035f9f 2019-10-06 stsp fi
706 e7303626 2020-05-14 stsp echo "got: wrong type of object" > $testroot/stderr.expected
707 e7303626 2020-05-14 stsp
708 e7303626 2020-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
709 fc414659 2022-04-16 thomas ret=$?
710 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
711 e7303626 2020-05-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
712 e7303626 2020-05-14 stsp return 1
713 e7303626 2020-05-14 stsp fi
714 63035f9f 2019-10-06 stsp test_done "$testroot" "$ret"
715 63035f9f 2019-10-06 stsp }
716 39449a05 2020-07-23 stsp
717 f6cae3ed 2020-09-13 naddy test_diff_symlinks_in_work_tree() {
718 39449a05 2020-07-23 stsp local testroot=`test_init diff_symlinks_in_work_tree`
719 39449a05 2020-07-23 stsp
720 39449a05 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
721 39449a05 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
722 39449a05 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
723 39449a05 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
724 39449a05 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
725 39449a05 2020-07-23 stsp (cd $testroot/repo && ln -s .got/foo dotgotfoo.link)
726 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add .
727 39449a05 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
728 39449a05 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
729 39449a05 2020-07-23 stsp
730 39449a05 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
731 fc414659 2022-04-16 thomas ret=$?
732 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
733 39449a05 2020-07-23 stsp test_done "$testroot" "$ret"
734 39449a05 2020-07-23 stsp return 1
735 39449a05 2020-07-23 stsp fi
736 39449a05 2020-07-23 stsp
737 39449a05 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
738 e6f45b72 2023-03-03 thomas (cd $testroot/wt && rm epsilon.link && ln -s gamma epsilon.link)
739 39449a05 2020-07-23 stsp (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link)
740 39449a05 2020-07-23 stsp echo -n '.got/bar' > $testroot/wt/dotgotfoo.link
741 39449a05 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
742 39449a05 2020-07-23 stsp (cd $testroot/wt && ln -sf epsilon/zeta zeta.link)
743 39449a05 2020-07-23 stsp (cd $testroot/wt && got add zeta.link > /dev/null)
744 39449a05 2020-07-23 stsp (cd $testroot/wt && got diff > $testroot/stdout)
745 63035f9f 2019-10-06 stsp
746 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
747 9b4458b4 2022-06-26 thomas echo "commit - $commit_id1" >> $testroot/stdout.expected
748 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
749 39449a05 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
750 39449a05 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i | \
751 39449a05 2020-07-23 stsp grep 'alpha.link@ -> alpha$' | \
752 39449a05 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
753 39449a05 2020-07-23 stsp echo 'file + alpha.link' >> $testroot/stdout.expected
754 39449a05 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
755 39449a05 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
756 39449a05 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
757 39449a05 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
758 39449a05 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
759 39449a05 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
760 39449a05 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
761 39449a05 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
762 39449a05 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i | \
763 39449a05 2020-07-23 stsp grep 'dotgotfoo.link@ -> .got/foo$' | \
764 39449a05 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
765 39449a05 2020-07-23 stsp echo 'file + dotgotfoo.link' >> $testroot/stdout.expected
766 39449a05 2020-07-23 stsp echo '--- dotgotfoo.link' >> $testroot/stdout.expected
767 39449a05 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
768 39449a05 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
769 39449a05 2020-07-23 stsp echo '-.got/foo' >> $testroot/stdout.expected
770 39449a05 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
771 39449a05 2020-07-23 stsp echo '+.got/bar' >> $testroot/stdout.expected
772 39449a05 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
773 39449a05 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
774 39449a05 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i epsilon | \
775 39449a05 2020-07-23 stsp grep 'beta.link@ -> ../beta$' | \
776 39449a05 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
777 39449a05 2020-07-23 stsp echo 'file + epsilon/beta.link' >> $testroot/stdout.expected
778 39449a05 2020-07-23 stsp echo '--- epsilon/beta.link' >> $testroot/stdout.expected
779 39449a05 2020-07-23 stsp echo '+++ epsilon/beta.link' >> $testroot/stdout.expected
780 39449a05 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
781 39449a05 2020-07-23 stsp echo '-../beta' >> $testroot/stdout.expected
782 39449a05 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
783 39449a05 2020-07-23 stsp echo '+../gamma/delta' >> $testroot/stdout.expected
784 4135d7d0 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
785 4135d7d0 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
786 4135d7d0 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i | \
787 4135d7d0 2020-07-23 stsp grep 'epsilon.link@ -> epsilon$' | \
788 4135d7d0 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
789 4135d7d0 2020-07-23 stsp echo 'file + epsilon.link' >> $testroot/stdout.expected
790 4135d7d0 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
791 4135d7d0 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
792 4135d7d0 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
793 4135d7d0 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
794 39449a05 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
795 4135d7d0 2020-07-23 stsp echo '+gamma' >> $testroot/stdout.expected
796 4135d7d0 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
797 39449a05 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
798 39449a05 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i | \
799 39449a05 2020-07-23 stsp grep 'nonexistent.link@ -> nonexistent$' | \
800 39449a05 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
801 39449a05 2020-07-23 stsp echo 'file + /dev/null' >> $testroot/stdout.expected
802 39449a05 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
803 1cb46f00 2020-11-21 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
804 39449a05 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
805 39449a05 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
806 39449a05 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
807 39449a05 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
808 6d054bb9 2022-09-23 thomas echo 'file + zeta.link (mode 120000)' >> $testroot/stdout.expected
809 1cb46f00 2020-11-21 stsp echo '--- /dev/null' >> $testroot/stdout.expected
810 40dde666 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
811 40dde666 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
812 40dde666 2020-07-23 stsp echo '+epsilon/zeta' >> $testroot/stdout.expected
813 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
814 40dde666 2020-07-23 stsp
815 40dde666 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
816 fc414659 2022-04-16 thomas ret=$?
817 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
818 40dde666 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
819 40dde666 2020-07-23 stsp fi
820 40dde666 2020-07-23 stsp test_done "$testroot" "$ret"
821 40dde666 2020-07-23 stsp }
822 40dde666 2020-07-23 stsp
823 f6cae3ed 2020-09-13 naddy test_diff_symlinks_in_repo() {
824 40dde666 2020-07-23 stsp local testroot=`test_init diff_symlinks_in_repo`
825 40dde666 2020-07-23 stsp
826 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
827 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
828 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
829 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
830 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
831 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -s .got/foo dotgotfoo.link)
832 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add .
833 40dde666 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
834 40dde666 2020-07-23 stsp local commit_id1=`git_show_head $testroot/repo`
835 40dde666 2020-07-23 stsp
836 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -sf beta alpha.link)
837 e6f45b72 2023-03-03 thomas (cd $testroot/repo && rm epsilon.link && ln -s gamma epsilon.link)
838 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
839 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -sf .got/bar $testroot/repo/dotgotfoo.link)
840 d1e03b8c 2023-10-08 thomas git -C $testroot/repo rm -q nonexistent.link
841 40dde666 2020-07-23 stsp (cd $testroot/repo && ln -sf epsilon/zeta zeta.link)
842 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add .
843 40dde666 2020-07-23 stsp git_commit $testroot/repo -m "change symlinks"
844 40dde666 2020-07-23 stsp local commit_id2=`git_show_head $testroot/repo`
845 40dde666 2020-07-23 stsp
846 40dde666 2020-07-23 stsp got diff -r $testroot/repo $commit_id1 $commit_id2 > $testroot/stdout
847 40dde666 2020-07-23 stsp
848 40dde666 2020-07-23 stsp echo "diff $commit_id1 $commit_id2" > $testroot/stdout.expected
849 9b4458b4 2022-06-26 thomas echo "commit - $commit_id1" >> $testroot/stdout.expected
850 9b4458b4 2022-06-26 thomas echo "commit + $commit_id2" >> $testroot/stdout.expected
851 40dde666 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
852 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i | \
853 40dde666 2020-07-23 stsp grep 'alpha.link@ -> alpha$' | \
854 40dde666 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
855 40dde666 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
856 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id2 -i | \
857 40dde666 2020-07-23 stsp grep 'alpha.link@ -> beta$' | \
858 40dde666 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
859 40dde666 2020-07-23 stsp echo '--- alpha.link' >> $testroot/stdout.expected
860 40dde666 2020-07-23 stsp echo '+++ alpha.link' >> $testroot/stdout.expected
861 40dde666 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
862 40dde666 2020-07-23 stsp echo '-alpha' >> $testroot/stdout.expected
863 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
864 40dde666 2020-07-23 stsp echo '+beta' >> $testroot/stdout.expected
865 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
866 40dde666 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
867 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i | \
868 40dde666 2020-07-23 stsp grep 'dotgotfoo.link@ -> .got/foo$' | \
869 40dde666 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
870 40dde666 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
871 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id2 -i | \
872 40dde666 2020-07-23 stsp grep 'dotgotfoo.link@ -> .got/bar$' | \
873 40dde666 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
874 40dde666 2020-07-23 stsp echo '--- dotgotfoo.link' >> $testroot/stdout.expected
875 40dde666 2020-07-23 stsp echo '+++ dotgotfoo.link' >> $testroot/stdout.expected
876 40dde666 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
877 40dde666 2020-07-23 stsp echo '-.got/foo' >> $testroot/stdout.expected
878 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
879 40dde666 2020-07-23 stsp echo '+.got/bar' >> $testroot/stdout.expected
880 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
881 40dde666 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
882 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i epsilon | \
883 40dde666 2020-07-23 stsp grep 'beta.link@ -> ../beta$' | \
884 40dde666 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
885 40dde666 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
886 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id2 -i epsilon | \
887 40dde666 2020-07-23 stsp grep 'beta.link@ -> ../gamma/delta$' | \
888 40dde666 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
889 40dde666 2020-07-23 stsp echo '--- epsilon/beta.link' >> $testroot/stdout.expected
890 40dde666 2020-07-23 stsp echo '+++ epsilon/beta.link' >> $testroot/stdout.expected
891 40dde666 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
892 40dde666 2020-07-23 stsp echo '-../beta' >> $testroot/stdout.expected
893 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
894 40dde666 2020-07-23 stsp echo '+../gamma/delta' >> $testroot/stdout.expected
895 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
896 40dde666 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
897 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i | \
898 40dde666 2020-07-23 stsp grep 'epsilon.link@ -> epsilon$' | \
899 40dde666 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
900 40dde666 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
901 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id2 -i | \
902 40dde666 2020-07-23 stsp grep 'epsilon.link@ -> gamma$' | \
903 40dde666 2020-07-23 stsp cut -d' ' -f 1 >> $testroot/stdout.expected
904 40dde666 2020-07-23 stsp echo '--- epsilon.link' >> $testroot/stdout.expected
905 40dde666 2020-07-23 stsp echo '+++ epsilon.link' >> $testroot/stdout.expected
906 40dde666 2020-07-23 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
907 40dde666 2020-07-23 stsp echo '-epsilon' >> $testroot/stdout.expected
908 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
909 40dde666 2020-07-23 stsp echo '+gamma' >> $testroot/stdout.expected
910 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
911 40dde666 2020-07-23 stsp echo -n 'blob - ' >> $testroot/stdout.expected
912 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id1 -i | \
913 40dde666 2020-07-23 stsp grep 'nonexistent.link@ -> nonexistent$' | \
914 40dde666 2020-07-23 stsp cut -d' ' -f 1 | sed -e 's/$/ (mode 120000)/' \
915 40dde666 2020-07-23 stsp >> $testroot/stdout.expected
916 40dde666 2020-07-23 stsp echo 'blob + /dev/null' >> $testroot/stdout.expected
917 40dde666 2020-07-23 stsp echo '--- nonexistent.link' >> $testroot/stdout.expected
918 40dde666 2020-07-23 stsp echo '+++ /dev/null' >> $testroot/stdout.expected
919 40dde666 2020-07-23 stsp echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
920 40dde666 2020-07-23 stsp echo '-nonexistent' >> $testroot/stdout.expected
921 40dde666 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
922 40dde666 2020-07-23 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
923 40dde666 2020-07-23 stsp echo -n 'blob + ' >> $testroot/stdout.expected
924 40dde666 2020-07-23 stsp got tree -r $testroot/repo -c $commit_id2 -i | \
925 40dde666 2020-07-23 stsp grep 'zeta.link@ -> epsilon/zeta$' | \
926 40dde666 2020-07-23 stsp cut -d' ' -f 1 | sed -e 's/$/ (mode 120000)/' \
927 40dde666 2020-07-23 stsp >> $testroot/stdout.expected
928 40dde666 2020-07-23 stsp echo '--- /dev/null' >> $testroot/stdout.expected
929 39449a05 2020-07-23 stsp echo '+++ zeta.link' >> $testroot/stdout.expected
930 39449a05 2020-07-23 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
931 39449a05 2020-07-23 stsp echo '+epsilon/zeta' >> $testroot/stdout.expected
932 39449a05 2020-07-23 stsp echo '\ No newline at end of file' >> $testroot/stdout.expected
933 39449a05 2020-07-23 stsp
934 39449a05 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
935 fc414659 2022-04-16 thomas ret=$?
936 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
937 39449a05 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
938 dffd0deb 2020-11-20 stsp fi
939 dffd0deb 2020-11-20 stsp test_done "$testroot" "$ret"
940 dffd0deb 2020-11-20 stsp }
941 dffd0deb 2020-11-20 stsp
942 dffd0deb 2020-11-20 stsp test_diff_binary_files() {
943 dffd0deb 2020-11-20 stsp local testroot=`test_init diff_binary_files`
944 dffd0deb 2020-11-20 stsp local head_rev=`git_show_head $testroot/repo`
945 dffd0deb 2020-11-20 stsp
946 dffd0deb 2020-11-20 stsp got checkout $testroot/repo $testroot/wt > /dev/null
947 fc414659 2022-04-16 thomas ret=$?
948 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
949 dffd0deb 2020-11-20 stsp test_done "$testroot" "$ret"
950 dffd0deb 2020-11-20 stsp return 1
951 dffd0deb 2020-11-20 stsp fi
952 dffd0deb 2020-11-20 stsp
953 dffd0deb 2020-11-20 stsp printf '\377\377\0\0\377\377\0\0' > $testroot/wt/foo
954 dffd0deb 2020-11-20 stsp (cd $testroot/wt && got add foo >/dev/null)
955 64453f7e 2020-11-21 stsp
956 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
957 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
958 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
959 64453f7e 2020-11-21 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
960 6d054bb9 2022-09-23 thomas echo 'file + foo (mode 644)' >> $testroot/stdout.expected
961 1cb46f00 2020-11-21 stsp echo "Binary files /dev/null and foo differ" \
962 1cb46f00 2020-11-21 stsp >> $testroot/stdout.expected
963 64453f7e 2020-11-21 stsp
964 64453f7e 2020-11-21 stsp (cd $testroot/wt && got diff > $testroot/stdout)
965 64453f7e 2020-11-21 stsp cmp -s $testroot/stdout.expected $testroot/stdout
966 fc414659 2022-04-16 thomas ret=$?
967 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
968 64453f7e 2020-11-21 stsp diff -a -u $testroot/stdout.expected $testroot/stdout
969 64453f7e 2020-11-21 stsp test_done "$testroot" "$ret"
970 64453f7e 2020-11-21 stsp return 1
971 64453f7e 2020-11-21 stsp fi
972 dffd0deb 2020-11-20 stsp
973 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
974 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
975 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
976 dffd0deb 2020-11-20 stsp echo 'blob - /dev/null' >> $testroot/stdout.expected
977 6d054bb9 2022-09-23 thomas echo 'file + foo (mode 644)' >> $testroot/stdout.expected
978 1cb46f00 2020-11-21 stsp echo '--- /dev/null' >> $testroot/stdout.expected
979 dffd0deb 2020-11-20 stsp echo '+++ foo' >> $testroot/stdout.expected
980 dffd0deb 2020-11-20 stsp echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
981 dffd0deb 2020-11-20 stsp printf '+\377\377\0\0\377\377\0\0\n' >> $testroot/stdout.expected
982 578133c9 2020-11-28 naddy printf '\\ No newline at end of file\n' >> $testroot/stdout.expected
983 dffd0deb 2020-11-20 stsp
984 64453f7e 2020-11-21 stsp (cd $testroot/wt && got diff -a > $testroot/stdout)
985 dffd0deb 2020-11-20 stsp cmp -s $testroot/stdout.expected $testroot/stdout
986 fc414659 2022-04-16 thomas ret=$?
987 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
988 dffd0deb 2020-11-20 stsp diff -a -u $testroot/stdout.expected $testroot/stdout
989 dffd0deb 2020-11-20 stsp test_done "$testroot" "$ret"
990 dffd0deb 2020-11-20 stsp return 1
991 39449a05 2020-07-23 stsp fi
992 dffd0deb 2020-11-20 stsp
993 dffd0deb 2020-11-20 stsp (cd $testroot/wt && got commit -m 'add binary file' > /dev/null)
994 dffd0deb 2020-11-20 stsp local head_rev=`git_show_head $testroot/repo`
995 dffd0deb 2020-11-20 stsp
996 dffd0deb 2020-11-20 stsp printf '\377\200\0\0\377\200\0\0' > $testroot/wt/foo
997 dffd0deb 2020-11-20 stsp
998 9b4458b4 2022-06-26 thomas echo "diff $testroot/wt" > $testroot/stdout.expected
999 9b4458b4 2022-06-26 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
1000 9b4458b4 2022-06-26 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
1001 dffd0deb 2020-11-20 stsp echo -n 'blob - ' >> $testroot/stdout.expected
1002 dffd0deb 2020-11-20 stsp got tree -r $testroot/repo -i | grep 'foo$' | cut -d' ' -f 1 \
1003 dffd0deb 2020-11-20 stsp >> $testroot/stdout.expected
1004 dffd0deb 2020-11-20 stsp echo 'file + foo' >> $testroot/stdout.expected
1005 dffd0deb 2020-11-20 stsp echo '--- foo' >> $testroot/stdout.expected
1006 dffd0deb 2020-11-20 stsp echo '+++ foo' >> $testroot/stdout.expected
1007 dffd0deb 2020-11-20 stsp echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1008 578133c9 2020-11-28 naddy printf -- '-\377\377\0\0\377\377\0\0\n' >> $testroot/stdout.expected
1009 578133c9 2020-11-28 naddy printf '\\ No newline at end of file\n' >> $testroot/stdout.expected
1010 dffd0deb 2020-11-20 stsp printf '+\377\200\0\0\377\200\0\0\n' >> $testroot/stdout.expected
1011 578133c9 2020-11-28 naddy printf '\\ No newline at end of file\n' >> $testroot/stdout.expected
1012 dffd0deb 2020-11-20 stsp
1013 64453f7e 2020-11-21 stsp (cd $testroot/wt && got diff -a > $testroot/stdout)
1014 dffd0deb 2020-11-20 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1015 fc414659 2022-04-16 thomas ret=$?
1016 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1017 dffd0deb 2020-11-20 stsp diff -a -u $testroot/stdout.expected $testroot/stdout
1018 cc8021af 2021-10-12 thomas fi
1019 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1020 cc8021af 2021-10-12 thomas }
1021 cc8021af 2021-10-12 thomas
1022 cc8021af 2021-10-12 thomas test_diff_commits() {
1023 cc8021af 2021-10-12 thomas local testroot=`test_init diff_commits`
1024 cc8021af 2021-10-12 thomas local commit_id0=`git_show_head $testroot/repo`
1025 e80ef83e 2023-01-10 thomas local alpha_id0=`get_blob_id $testroot/repo "" alpha`
1026 e80ef83e 2023-01-10 thomas local beta_id0=`get_blob_id $testroot/repo "" beta`
1027 cc8021af 2021-10-12 thomas
1028 cc8021af 2021-10-12 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1029 fc414659 2022-04-16 thomas ret=$?
1030 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1031 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1032 cc8021af 2021-10-12 thomas return 1
1033 cc8021af 2021-10-12 thomas fi
1034 cc8021af 2021-10-12 thomas
1035 cc8021af 2021-10-12 thomas echo "modified alpha" > $testroot/wt/alpha
1036 cc8021af 2021-10-12 thomas (cd $testroot/wt && got rm beta >/dev/null)
1037 cc8021af 2021-10-12 thomas echo "new file" > $testroot/wt/new
1038 cc8021af 2021-10-12 thomas (cd $testroot/wt && got add new >/dev/null)
1039 cc8021af 2021-10-12 thomas (cd $testroot/wt && got commit -m 'committing changes' >/dev/null)
1040 cc8021af 2021-10-12 thomas local commit_id1=`git_show_head $testroot/repo`
1041 cc8021af 2021-10-12 thomas
1042 cc8021af 2021-10-12 thomas alpha_id1=`get_blob_id $testroot/repo "" alpha`
1043 cc8021af 2021-10-12 thomas new_id1=`get_blob_id $testroot/repo "" new`
1044 cc8021af 2021-10-12 thomas
1045 cc8021af 2021-10-12 thomas echo "diff $commit_id0 refs/heads/master" > $testroot/stdout.expected
1046 9b4458b4 2022-06-26 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
1047 9b4458b4 2022-06-26 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
1048 cc8021af 2021-10-12 thomas echo "blob - $alpha_id0" >> $testroot/stdout.expected
1049 cc8021af 2021-10-12 thomas echo "blob + $alpha_id1" >> $testroot/stdout.expected
1050 cc8021af 2021-10-12 thomas echo '--- alpha' >> $testroot/stdout.expected
1051 cc8021af 2021-10-12 thomas echo '+++ alpha' >> $testroot/stdout.expected
1052 cc8021af 2021-10-12 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1053 cc8021af 2021-10-12 thomas echo '-alpha' >> $testroot/stdout.expected
1054 cc8021af 2021-10-12 thomas echo '+modified alpha' >> $testroot/stdout.expected
1055 cc8021af 2021-10-12 thomas echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected
1056 cc8021af 2021-10-12 thomas echo 'blob + /dev/null' >> $testroot/stdout.expected
1057 cc8021af 2021-10-12 thomas echo '--- beta' >> $testroot/stdout.expected
1058 cc8021af 2021-10-12 thomas echo '+++ /dev/null' >> $testroot/stdout.expected
1059 cc8021af 2021-10-12 thomas echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1060 cc8021af 2021-10-12 thomas echo '-beta' >> $testroot/stdout.expected
1061 cc8021af 2021-10-12 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1062 cc8021af 2021-10-12 thomas echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected
1063 cc8021af 2021-10-12 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1064 cc8021af 2021-10-12 thomas echo '+++ new' >> $testroot/stdout.expected
1065 cc8021af 2021-10-12 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1066 cc8021af 2021-10-12 thomas echo '+new file' >> $testroot/stdout.expected
1067 cc8021af 2021-10-12 thomas
1068 cc8021af 2021-10-12 thomas (cd $testroot/wt && got diff -c master > $testroot/stdout)
1069 cc8021af 2021-10-12 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1070 fc414659 2022-04-16 thomas ret=$?
1071 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1072 cc8021af 2021-10-12 thomas diff -u $testroot/stdout.expected $testroot/stdout
1073 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1074 cc8021af 2021-10-12 thomas return 1
1075 cc8021af 2021-10-12 thomas fi
1076 cc8021af 2021-10-12 thomas
1077 cc8021af 2021-10-12 thomas # same diff with explicit parent commit ID
1078 cc8021af 2021-10-12 thomas (cd $testroot/wt && got diff -c $commit_id0 -c master \
1079 cc8021af 2021-10-12 thomas > $testroot/stdout)
1080 cc8021af 2021-10-12 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1081 fc414659 2022-04-16 thomas ret=$?
1082 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1083 cc8021af 2021-10-12 thomas diff -u $testroot/stdout.expected $testroot/stdout
1084 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1085 cc8021af 2021-10-12 thomas return 1
1086 cc8021af 2021-10-12 thomas fi
1087 cc8021af 2021-10-12 thomas
1088 cc8021af 2021-10-12 thomas # same diff with commit object IDs
1089 cc8021af 2021-10-12 thomas echo "diff $commit_id0 $commit_id1" > $testroot/stdout.expected
1090 9b4458b4 2022-06-26 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
1091 9b4458b4 2022-06-26 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
1092 cc8021af 2021-10-12 thomas echo "blob - $alpha_id0" >> $testroot/stdout.expected
1093 cc8021af 2021-10-12 thomas echo "blob + $alpha_id1" >> $testroot/stdout.expected
1094 cc8021af 2021-10-12 thomas echo '--- alpha' >> $testroot/stdout.expected
1095 cc8021af 2021-10-12 thomas echo '+++ alpha' >> $testroot/stdout.expected
1096 cc8021af 2021-10-12 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1097 cc8021af 2021-10-12 thomas echo '-alpha' >> $testroot/stdout.expected
1098 cc8021af 2021-10-12 thomas echo '+modified alpha' >> $testroot/stdout.expected
1099 cc8021af 2021-10-12 thomas echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected
1100 cc8021af 2021-10-12 thomas echo 'blob + /dev/null' >> $testroot/stdout.expected
1101 cc8021af 2021-10-12 thomas echo '--- beta' >> $testroot/stdout.expected
1102 cc8021af 2021-10-12 thomas echo '+++ /dev/null' >> $testroot/stdout.expected
1103 cc8021af 2021-10-12 thomas echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1104 cc8021af 2021-10-12 thomas echo '-beta' >> $testroot/stdout.expected
1105 cc8021af 2021-10-12 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1106 cc8021af 2021-10-12 thomas echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected
1107 cc8021af 2021-10-12 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1108 cc8021af 2021-10-12 thomas echo '+++ new' >> $testroot/stdout.expected
1109 cc8021af 2021-10-12 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1110 cc8021af 2021-10-12 thomas echo '+new file' >> $testroot/stdout.expected
1111 cc8021af 2021-10-12 thomas (cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 \
1112 cc8021af 2021-10-12 thomas > $testroot/stdout)
1113 cc8021af 2021-10-12 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1114 fc414659 2022-04-16 thomas ret=$?
1115 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1116 cc8021af 2021-10-12 thomas diff -u $testroot/stdout.expected $testroot/stdout
1117 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1118 cc8021af 2021-10-12 thomas return 1
1119 cc8021af 2021-10-12 thomas fi
1120 cc8021af 2021-10-12 thomas
1121 cc8021af 2021-10-12 thomas # same diff, filtered by paths
1122 cc8021af 2021-10-12 thomas echo "diff $commit_id0 $commit_id1" > $testroot/stdout.expected
1123 9b4458b4 2022-06-26 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
1124 9b4458b4 2022-06-26 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
1125 cc8021af 2021-10-12 thomas echo "blob - $alpha_id0" >> $testroot/stdout.expected
1126 cc8021af 2021-10-12 thomas echo "blob + $alpha_id1" >> $testroot/stdout.expected
1127 cc8021af 2021-10-12 thomas echo '--- alpha' >> $testroot/stdout.expected
1128 cc8021af 2021-10-12 thomas echo '+++ alpha' >> $testroot/stdout.expected
1129 cc8021af 2021-10-12 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1130 cc8021af 2021-10-12 thomas echo '-alpha' >> $testroot/stdout.expected
1131 cc8021af 2021-10-12 thomas echo '+modified alpha' >> $testroot/stdout.expected
1132 cc8021af 2021-10-12 thomas (cd $testroot/repo && got diff -c $commit_id0 -c $commit_id1 alpha \
1133 cc8021af 2021-10-12 thomas > $testroot/stdout)
1134 cc8021af 2021-10-12 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1135 fc414659 2022-04-16 thomas ret=$?
1136 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1137 cc8021af 2021-10-12 thomas diff -u $testroot/stdout.expected $testroot/stdout
1138 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1139 cc8021af 2021-10-12 thomas return 1
1140 cc8021af 2021-10-12 thomas fi
1141 cc8021af 2021-10-12 thomas # same in a work tree
1142 cc8021af 2021-10-12 thomas (cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 alpha \
1143 cc8021af 2021-10-12 thomas > $testroot/stdout)
1144 cc8021af 2021-10-12 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1145 fc414659 2022-04-16 thomas ret=$?
1146 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1147 cc8021af 2021-10-12 thomas diff -u $testroot/stdout.expected $testroot/stdout
1148 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1149 cc8021af 2021-10-12 thomas return 1
1150 dffd0deb 2020-11-20 stsp fi
1151 cc8021af 2021-10-12 thomas
1152 cc8021af 2021-10-12 thomas echo "diff $commit_id0 $commit_id1" > $testroot/stdout.expected
1153 9b4458b4 2022-06-26 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
1154 9b4458b4 2022-06-26 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
1155 cc8021af 2021-10-12 thomas echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected
1156 cc8021af 2021-10-12 thomas echo 'blob + /dev/null' >> $testroot/stdout.expected
1157 cc8021af 2021-10-12 thomas echo '--- beta' >> $testroot/stdout.expected
1158 cc8021af 2021-10-12 thomas echo '+++ /dev/null' >> $testroot/stdout.expected
1159 cc8021af 2021-10-12 thomas echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1160 cc8021af 2021-10-12 thomas echo '-beta' >> $testroot/stdout.expected
1161 cc8021af 2021-10-12 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1162 cc8021af 2021-10-12 thomas echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected
1163 cc8021af 2021-10-12 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1164 cc8021af 2021-10-12 thomas echo '+++ new' >> $testroot/stdout.expected
1165 cc8021af 2021-10-12 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1166 cc8021af 2021-10-12 thomas echo '+new file' >> $testroot/stdout.expected
1167 cc8021af 2021-10-12 thomas (cd $testroot/repo && got diff -c $commit_id0 -c $commit_id1 \
1168 cc8021af 2021-10-12 thomas beta new > $testroot/stdout)
1169 cc8021af 2021-10-12 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1170 fc414659 2022-04-16 thomas ret=$?
1171 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1172 cc8021af 2021-10-12 thomas diff -u $testroot/stdout.expected $testroot/stdout
1173 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1174 cc8021af 2021-10-12 thomas return 1
1175 cc8021af 2021-10-12 thomas fi
1176 cc8021af 2021-10-12 thomas
1177 cc8021af 2021-10-12 thomas # more than two -c options are not allowed
1178 cc8021af 2021-10-12 thomas (cd $testroot/repo && got diff -c $commit_id0 -c $commit_id1 -c foo \
1179 cc8021af 2021-10-12 thomas 2> $testroot/stderr)
1180 fc414659 2022-04-16 thomas ret=$?
1181 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1182 cc8021af 2021-10-12 thomas echo "diff succeeded unexpectedly" >&2
1183 cc8021af 2021-10-12 thomas test_done "$testroot" "1"
1184 cc8021af 2021-10-12 thomas return 1
1185 cc8021af 2021-10-12 thomas fi
1186 cc8021af 2021-10-12 thomas echo "got: too many -c options used" > $testroot/stderr.expected
1187 cc8021af 2021-10-12 thomas cmp -s $testroot/stderr.expected $testroot/stderr
1188 fc414659 2022-04-16 thomas ret=$?
1189 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1190 cc8021af 2021-10-12 thomas diff -u $testroot/stderr.expected $testroot/stderr
1191 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1192 cc8021af 2021-10-12 thomas return 1
1193 cc8021af 2021-10-12 thomas fi
1194 cc8021af 2021-10-12 thomas
1195 cc8021af 2021-10-12 thomas # use of -c options implies a repository diff; use with -P is an error
1196 cc8021af 2021-10-12 thomas (cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 -P foo \
1197 cc8021af 2021-10-12 thomas 2> $testroot/stderr)
1198 fc414659 2022-04-16 thomas ret=$?
1199 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1200 cc8021af 2021-10-12 thomas echo "diff succeeded unexpectedly" >&2
1201 cc8021af 2021-10-12 thomas test_done "$testroot" "1"
1202 cc8021af 2021-10-12 thomas return 1
1203 cc8021af 2021-10-12 thomas fi
1204 cc8021af 2021-10-12 thomas echo "got: -P option can only be used when diffing a work tree" \
1205 cc8021af 2021-10-12 thomas > $testroot/stderr.expected
1206 cc8021af 2021-10-12 thomas cmp -s $testroot/stderr.expected $testroot/stderr
1207 fc414659 2022-04-16 thomas ret=$?
1208 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1209 cc8021af 2021-10-12 thomas diff -u $testroot/stderr.expected $testroot/stderr
1210 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1211 cc8021af 2021-10-12 thomas return 1
1212 cc8021af 2021-10-12 thomas fi
1213 cc8021af 2021-10-12 thomas
1214 cc8021af 2021-10-12 thomas # use of -c options implies a repository diff; use with -s is an error
1215 cc8021af 2021-10-12 thomas (cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 -s foo \
1216 cc8021af 2021-10-12 thomas 2> $testroot/stderr)
1217 fc414659 2022-04-16 thomas ret=$?
1218 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1219 cc8021af 2021-10-12 thomas echo "diff succeeded unexpectedly" >&2
1220 cc8021af 2021-10-12 thomas test_done "$testroot" "1"
1221 cc8021af 2021-10-12 thomas return 1
1222 cc8021af 2021-10-12 thomas fi
1223 cc8021af 2021-10-12 thomas echo "got: -s option can only be used when diffing a work tree" \
1224 cc8021af 2021-10-12 thomas > $testroot/stderr.expected
1225 cc8021af 2021-10-12 thomas cmp -s $testroot/stderr.expected $testroot/stderr
1226 fc414659 2022-04-16 thomas ret=$?
1227 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1228 cc8021af 2021-10-12 thomas diff -u $testroot/stderr.expected $testroot/stderr
1229 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1230 cc8021af 2021-10-12 thomas return 1
1231 cc8021af 2021-10-12 thomas fi
1232 cc8021af 2021-10-12 thomas
1233 cc8021af 2021-10-12 thomas # three arguments imply use of path filtering (repository case)
1234 cc8021af 2021-10-12 thomas (cd $testroot/repo && got diff $commit_id0 $commit_id1 foo \
1235 cc8021af 2021-10-12 thomas 2> $testroot/stderr)
1236 fc414659 2022-04-16 thomas ret=$?
1237 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1238 cc8021af 2021-10-12 thomas echo "diff succeeded unexpectedly" >&2
1239 cc8021af 2021-10-12 thomas test_done "$testroot" "1"
1240 cc8021af 2021-10-12 thomas return 1
1241 cc8021af 2021-10-12 thomas fi
1242 ad10f64e 2023-07-19 thomas echo "got: specified paths cannot be resolved: no work tree found" \
1243 cc8021af 2021-10-12 thomas > $testroot/stderr.expected
1244 cc8021af 2021-10-12 thomas cmp -s $testroot/stderr.expected $testroot/stderr
1245 fc414659 2022-04-16 thomas ret=$?
1246 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1247 cc8021af 2021-10-12 thomas diff -u $testroot/stderr.expected $testroot/stderr
1248 cc8021af 2021-10-12 thomas test_done "$testroot" "$ret"
1249 cc8021af 2021-10-12 thomas return 1
1250 cc8021af 2021-10-12 thomas fi
1251 cc8021af 2021-10-12 thomas
1252 cc8021af 2021-10-12 thomas # three arguments imply use of path filtering (work tree case)
1253 f1417e9f 2021-10-12 thomas (cd $testroot/wt && got diff $commit_id0 master foo \
1254 cc8021af 2021-10-12 thomas 2> $testroot/stderr)
1255 fc414659 2022-04-16 thomas ret=$?
1256 fc414659 2022-04-16 thomas if [ $ret -eq 0 ]; then
1257 cc8021af 2021-10-12 thomas echo "diff succeeded unexpectedly" >&2
1258 cc8021af 2021-10-12 thomas test_done "$testroot" "1"
1259 cc8021af 2021-10-12 thomas return 1
1260 cc8021af 2021-10-12 thomas fi
1261 cc8021af 2021-10-12 thomas echo "got: $commit_id0: No such file or directory" \
1262 cc8021af 2021-10-12 thomas > $testroot/stderr.expected
1263 cc8021af 2021-10-12 thomas cmp -s $testroot/stderr.expected $testroot/stderr
1264 fc414659 2022-04-16 thomas ret=$?
1265 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1266 cc8021af 2021-10-12 thomas diff -u $testroot/stderr.expected $testroot/stderr
1267 cc8021af 2021-10-12 thomas fi
1268 39449a05 2020-07-23 stsp test_done "$testroot" "$ret"
1269 39449a05 2020-07-23 stsp }
1270 39449a05 2020-07-23 stsp
1271 47d17b68 2022-02-12 thomas test_diff_ignored_file() {
1272 47d17b68 2022-02-12 thomas local testroot=`test_init diff_ignored_file`
1273 47d17b68 2022-02-12 thomas
1274 47d17b68 2022-02-12 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1275 47d17b68 2022-02-12 thomas ret=$?
1276 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1277 47d17b68 2022-02-12 thomas test_done "$testroot" "$ret"
1278 47d17b68 2022-02-12 thomas return 1
1279 47d17b68 2022-02-12 thomas fi
1280 47d17b68 2022-02-12 thomas
1281 47d17b68 2022-02-12 thomas echo 1 > $testroot/wt/number
1282 47d17b68 2022-02-12 thomas (cd $testroot/wt && got add number >/dev/null)
1283 47d17b68 2022-02-12 thomas (cd $testroot/wt && got commit -m 'add number' >/dev/null)
1284 47d17b68 2022-02-12 thomas
1285 47d17b68 2022-02-12 thomas echo "**/number" > $testroot/wt/.gitignore
1286 47d17b68 2022-02-12 thomas
1287 47d17b68 2022-02-12 thomas echo 2 > $testroot/wt/number
1288 47d17b68 2022-02-12 thomas (cd $testroot/wt && got diff number | sed '1,/^@@/d' > $testroot/stdout)
1289 47d17b68 2022-02-12 thomas
1290 47d17b68 2022-02-12 thomas echo "-1" > $testroot/stdout.expected
1291 47d17b68 2022-02-12 thomas echo "+2" >> $testroot/stdout.expected
1292 47d17b68 2022-02-12 thomas
1293 47d17b68 2022-02-12 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1294 47d17b68 2022-02-12 thomas ret=$?
1295 fc414659 2022-04-16 thomas if [ $ret -ne 0 ]; then
1296 47d17b68 2022-02-12 thomas diff -u $testroot/stdout.expected $testroot/stdout
1297 47d17b68 2022-02-12 thomas fi
1298 47d17b68 2022-02-12 thomas test_done "$testroot" "$ret"
1299 47d17b68 2022-02-12 thomas }
1300 831297da 2022-07-26 thomas
1301 831297da 2022-07-26 thomas test_diff_crlf() {
1302 831297da 2022-07-26 thomas local testroot=`test_init diff_crlf`
1303 831297da 2022-07-26 thomas
1304 831297da 2022-07-26 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1305 831297da 2022-07-26 thomas ret=$?
1306 831297da 2022-07-26 thomas if [ $ret -ne 0 ]; then
1307 831297da 2022-07-26 thomas test_done "$testroot" $ret
1308 831297da 2022-07-26 thomas return 1
1309 831297da 2022-07-26 thomas fi
1310 47d17b68 2022-02-12 thomas
1311 11de1f0a 2023-05-14 thomas printf 'one\r\ntwo\r\nthree\r\n' > $testroot/wt/crlf
1312 831297da 2022-07-26 thomas (cd $testroot/wt && got add crlf && got commit -m +crlf) >/dev/null
1313 831297da 2022-07-26 thomas ret=$?
1314 831297da 2022-07-26 thomas if [ $ret -ne 0 ]; then
1315 831297da 2022-07-26 thomas test_done "$testroot" $ret
1316 831297da 2022-07-26 thomas return 1
1317 831297da 2022-07-26 thomas fi
1318 831297da 2022-07-26 thomas
1319 11de1f0a 2023-05-14 thomas printf 'one\r\ntwain\r\nthree\r\n' > $testroot/wt/crlf
1320 11de1f0a 2023-05-14 thomas (cd $testroot/wt && got diff | sed -n '/^---/,$l' > $testroot/stdout)
1321 11de1f0a 2023-05-14 thomas cat <<\EOF > $testroot/stdout.expected
1322 11de1f0a 2023-05-14 thomas --- crlf$
1323 11de1f0a 2023-05-14 thomas +++ crlf$
1324 11de1f0a 2023-05-14 thomas @@ -1,3 +1,3 @@$
1325 11de1f0a 2023-05-14 thomas one\r$
1326 11de1f0a 2023-05-14 thomas -two\r$
1327 11de1f0a 2023-05-14 thomas +twain\r$
1328 11de1f0a 2023-05-14 thomas three\r$
1329 6d054bb9 2022-09-23 thomas EOF
1330 6d054bb9 2022-09-23 thomas
1331 6d054bb9 2022-09-23 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1332 6d054bb9 2022-09-23 thomas ret=$?
1333 6d054bb9 2022-09-23 thomas if [ $ret -ne 0 ]; then
1334 6d054bb9 2022-09-23 thomas diff -u $testroot/stdout.expected $testroot/stdout
1335 6d054bb9 2022-09-23 thomas fi
1336 6d054bb9 2022-09-23 thomas test_done "$testroot" $ret
1337 6d054bb9 2022-09-23 thomas }
1338 6d054bb9 2022-09-23 thomas
1339 6d054bb9 2022-09-23 thomas test_diff_worktree_newfile_xbit() {
1340 6d054bb9 2022-09-23 thomas local testroot=`test_init diff_worktree_newfile_xbit`
1341 6d054bb9 2022-09-23 thomas
1342 6d054bb9 2022-09-23 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1343 6d054bb9 2022-09-23 thomas ret=$?
1344 6d054bb9 2022-09-23 thomas if [ $ret -ne 0 ]; then
1345 6d054bb9 2022-09-23 thomas test_done "$testroot" $ret
1346 6d054bb9 2022-09-23 thomas return 1
1347 6d054bb9 2022-09-23 thomas fi
1348 6d054bb9 2022-09-23 thomas
1349 6d054bb9 2022-09-23 thomas echo xfile > $testroot/wt/xfile
1350 6d054bb9 2022-09-23 thomas chmod +x $testroot/wt/xfile
1351 6d054bb9 2022-09-23 thomas (cd $testroot/wt && got add xfile) > /dev/null
1352 6d054bb9 2022-09-23 thomas ret=$?
1353 6d054bb9 2022-09-23 thomas if [ $ret -ne 0 ]; then
1354 6d054bb9 2022-09-23 thomas test_done "$testroot" $ret
1355 6d054bb9 2022-09-23 thomas return 1
1356 6d054bb9 2022-09-23 thomas fi
1357 6d054bb9 2022-09-23 thomas (cd $testroot/wt && got diff) > $testroot/stdout
1358 6d054bb9 2022-09-23 thomas ret=$?
1359 6d054bb9 2022-09-23 thomas if [ $ret -ne 0 ]; then
1360 6d054bb9 2022-09-23 thomas test_done "$testroot" $ret
1361 6d054bb9 2022-09-23 thomas return 1
1362 6d054bb9 2022-09-23 thomas fi
1363 6d054bb9 2022-09-23 thomas
1364 6d054bb9 2022-09-23 thomas local commit_id=`git_show_head $testroot/repo`
1365 6d054bb9 2022-09-23 thomas cat <<EOF > $testroot/stdout.expected
1366 6d054bb9 2022-09-23 thomas diff $testroot/wt
1367 6d054bb9 2022-09-23 thomas commit - $commit_id
1368 6d054bb9 2022-09-23 thomas path + $testroot/wt
1369 6d054bb9 2022-09-23 thomas blob - /dev/null
1370 6d054bb9 2022-09-23 thomas file + xfile (mode 755)
1371 6d054bb9 2022-09-23 thomas --- /dev/null
1372 6d054bb9 2022-09-23 thomas +++ xfile
1373 6d054bb9 2022-09-23 thomas @@ -0,0 +1 @@
1374 6d054bb9 2022-09-23 thomas +xfile
1375 831297da 2022-07-26 thomas EOF
1376 831297da 2022-07-26 thomas
1377 831297da 2022-07-26 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1378 831297da 2022-07-26 thomas ret=$?
1379 831297da 2022-07-26 thomas if [ $ret -ne 0 ]; then
1380 6d054bb9 2022-09-23 thomas echo "failed to record mode 755"
1381 831297da 2022-07-26 thomas diff -u $testroot/stdout.expected $testroot/stdout
1382 831297da 2022-07-26 thomas fi
1383 831297da 2022-07-26 thomas test_done "$testroot" $ret
1384 e80ef83e 2023-01-10 thomas }
1385 e80ef83e 2023-01-10 thomas
1386 e80ef83e 2023-01-10 thomas test_diff_commit_diffstat() {
1387 e80ef83e 2023-01-10 thomas local testroot=`test_init diff_commit_diffstat`
1388 e80ef83e 2023-01-10 thomas local commit_id0=`git_show_head $testroot/repo`
1389 e80ef83e 2023-01-10 thomas local alpha_id0=`get_blob_id $testroot/repo "" alpha`
1390 e80ef83e 2023-01-10 thomas local beta_id0=`get_blob_id $testroot/repo "" beta`
1391 e80ef83e 2023-01-10 thomas
1392 e80ef83e 2023-01-10 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1393 e80ef83e 2023-01-10 thomas ret=$?
1394 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1395 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1396 e80ef83e 2023-01-10 thomas return 1
1397 e80ef83e 2023-01-10 thomas fi
1398 e80ef83e 2023-01-10 thomas
1399 e80ef83e 2023-01-10 thomas echo "modified alpha" > $testroot/wt/alpha
1400 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got rm beta >/dev/null)
1401 e80ef83e 2023-01-10 thomas echo "new file" > $testroot/wt/new
1402 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got add new >/dev/null)
1403 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got commit -m 'committing changes' >/dev/null)
1404 e80ef83e 2023-01-10 thomas local commit_id1=`git_show_head $testroot/repo`
1405 e80ef83e 2023-01-10 thomas
1406 9c677dea 2023-01-10 thomas local alpha_id1=`get_blob_id $testroot/repo "" alpha`
1407 9c677dea 2023-01-10 thomas local new_id1=`get_blob_id $testroot/repo "" new`
1408 e80ef83e 2023-01-10 thomas
1409 e80ef83e 2023-01-10 thomas cat <<EOF >$testroot/stdout.expected
1410 e80ef83e 2023-01-10 thomas diffstat $commit_id0 refs/heads/master
1411 e80ef83e 2023-01-10 thomas M alpha | 1+ 1-
1412 e80ef83e 2023-01-10 thomas D beta | 0+ 1-
1413 e80ef83e 2023-01-10 thomas A new | 1+ 0-
1414 e80ef83e 2023-01-10 thomas
1415 e80ef83e 2023-01-10 thomas 3 files changed, 2 insertions(+), 2 deletions(-)
1416 e80ef83e 2023-01-10 thomas
1417 e80ef83e 2023-01-10 thomas EOF
1418 e80ef83e 2023-01-10 thomas
1419 e80ef83e 2023-01-10 thomas echo "diff $commit_id0 refs/heads/master" >> $testroot/stdout.expected
1420 e80ef83e 2023-01-10 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
1421 e80ef83e 2023-01-10 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
1422 e80ef83e 2023-01-10 thomas echo "blob - $alpha_id0" >> $testroot/stdout.expected
1423 e80ef83e 2023-01-10 thomas echo "blob + $alpha_id1" >> $testroot/stdout.expected
1424 e80ef83e 2023-01-10 thomas echo '--- alpha' >> $testroot/stdout.expected
1425 e80ef83e 2023-01-10 thomas echo '+++ alpha' >> $testroot/stdout.expected
1426 e80ef83e 2023-01-10 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1427 e80ef83e 2023-01-10 thomas echo '-alpha' >> $testroot/stdout.expected
1428 e80ef83e 2023-01-10 thomas echo '+modified alpha' >> $testroot/stdout.expected
1429 e80ef83e 2023-01-10 thomas echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected
1430 e80ef83e 2023-01-10 thomas echo 'blob + /dev/null' >> $testroot/stdout.expected
1431 e80ef83e 2023-01-10 thomas echo '--- beta' >> $testroot/stdout.expected
1432 e80ef83e 2023-01-10 thomas echo '+++ /dev/null' >> $testroot/stdout.expected
1433 e80ef83e 2023-01-10 thomas echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1434 e80ef83e 2023-01-10 thomas echo '-beta' >> $testroot/stdout.expected
1435 e80ef83e 2023-01-10 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1436 e80ef83e 2023-01-10 thomas echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected
1437 e80ef83e 2023-01-10 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1438 e80ef83e 2023-01-10 thomas echo '+++ new' >> $testroot/stdout.expected
1439 e80ef83e 2023-01-10 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1440 e80ef83e 2023-01-10 thomas echo '+new file' >> $testroot/stdout.expected
1441 e80ef83e 2023-01-10 thomas
1442 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got diff -d -c master > $testroot/stdout)
1443 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1444 e80ef83e 2023-01-10 thomas ret=$?
1445 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1446 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1447 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1448 e80ef83e 2023-01-10 thomas return 1
1449 e80ef83e 2023-01-10 thomas fi
1450 e80ef83e 2023-01-10 thomas
1451 e80ef83e 2023-01-10 thomas # same diffstat with explicit parent commit ID
1452 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got diff -d -c $commit_id0 -c master \
1453 e80ef83e 2023-01-10 thomas > $testroot/stdout)
1454 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1455 e80ef83e 2023-01-10 thomas ret=$?
1456 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1457 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1458 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1459 e80ef83e 2023-01-10 thomas return 1
1460 e80ef83e 2023-01-10 thomas fi
1461 e80ef83e 2023-01-10 thomas
1462 e80ef83e 2023-01-10 thomas cat <<EOF >$testroot/stdout.expected
1463 e80ef83e 2023-01-10 thomas diffstat $commit_id0 $commit_id1
1464 e80ef83e 2023-01-10 thomas M alpha | 1+ 1-
1465 e80ef83e 2023-01-10 thomas D beta | 0+ 1-
1466 e80ef83e 2023-01-10 thomas A new | 1+ 0-
1467 e80ef83e 2023-01-10 thomas
1468 e80ef83e 2023-01-10 thomas 3 files changed, 2 insertions(+), 2 deletions(-)
1469 e80ef83e 2023-01-10 thomas
1470 e80ef83e 2023-01-10 thomas EOF
1471 e80ef83e 2023-01-10 thomas
1472 e80ef83e 2023-01-10 thomas # same diffstat with commit object IDs
1473 e80ef83e 2023-01-10 thomas echo "diff $commit_id0 $commit_id1" >> $testroot/stdout.expected
1474 e80ef83e 2023-01-10 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
1475 e80ef83e 2023-01-10 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
1476 e80ef83e 2023-01-10 thomas echo "blob - $alpha_id0" >> $testroot/stdout.expected
1477 e80ef83e 2023-01-10 thomas echo "blob + $alpha_id1" >> $testroot/stdout.expected
1478 e80ef83e 2023-01-10 thomas echo '--- alpha' >> $testroot/stdout.expected
1479 e80ef83e 2023-01-10 thomas echo '+++ alpha' >> $testroot/stdout.expected
1480 e80ef83e 2023-01-10 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1481 e80ef83e 2023-01-10 thomas echo '-alpha' >> $testroot/stdout.expected
1482 e80ef83e 2023-01-10 thomas echo '+modified alpha' >> $testroot/stdout.expected
1483 e80ef83e 2023-01-10 thomas echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected
1484 e80ef83e 2023-01-10 thomas echo 'blob + /dev/null' >> $testroot/stdout.expected
1485 e80ef83e 2023-01-10 thomas echo '--- beta' >> $testroot/stdout.expected
1486 e80ef83e 2023-01-10 thomas echo '+++ /dev/null' >> $testroot/stdout.expected
1487 e80ef83e 2023-01-10 thomas echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1488 e80ef83e 2023-01-10 thomas echo '-beta' >> $testroot/stdout.expected
1489 e80ef83e 2023-01-10 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1490 e80ef83e 2023-01-10 thomas echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected
1491 e80ef83e 2023-01-10 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1492 e80ef83e 2023-01-10 thomas echo '+++ new' >> $testroot/stdout.expected
1493 e80ef83e 2023-01-10 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1494 e80ef83e 2023-01-10 thomas echo '+new file' >> $testroot/stdout.expected
1495 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got diff -d -c $commit_id0 -c $commit_id1 \
1496 e80ef83e 2023-01-10 thomas > $testroot/stdout)
1497 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1498 e80ef83e 2023-01-10 thomas ret=$?
1499 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1500 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1501 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1502 e80ef83e 2023-01-10 thomas return 1
1503 e80ef83e 2023-01-10 thomas fi
1504 e80ef83e 2023-01-10 thomas
1505 e80ef83e 2023-01-10 thomas cat <<EOF >$testroot/stdout.expected
1506 e80ef83e 2023-01-10 thomas diffstat $commit_id0 $commit_id1
1507 e80ef83e 2023-01-10 thomas M alpha | 1+ 1-
1508 e80ef83e 2023-01-10 thomas
1509 28466fca 2023-01-19 thomas 1 file changed, 1 insertion(+), 1 deletion(-)
1510 e80ef83e 2023-01-10 thomas
1511 e80ef83e 2023-01-10 thomas EOF
1512 e80ef83e 2023-01-10 thomas
1513 e80ef83e 2023-01-10 thomas # same diffstat filtered by path "alpha"
1514 e80ef83e 2023-01-10 thomas echo "diff $commit_id0 $commit_id1" >> $testroot/stdout.expected
1515 e80ef83e 2023-01-10 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
1516 e80ef83e 2023-01-10 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
1517 e80ef83e 2023-01-10 thomas echo "blob - $alpha_id0" >> $testroot/stdout.expected
1518 e80ef83e 2023-01-10 thomas echo "blob + $alpha_id1" >> $testroot/stdout.expected
1519 e80ef83e 2023-01-10 thomas echo '--- alpha' >> $testroot/stdout.expected
1520 e80ef83e 2023-01-10 thomas echo '+++ alpha' >> $testroot/stdout.expected
1521 e80ef83e 2023-01-10 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1522 e80ef83e 2023-01-10 thomas echo '-alpha' >> $testroot/stdout.expected
1523 e80ef83e 2023-01-10 thomas echo '+modified alpha' >> $testroot/stdout.expected
1524 e80ef83e 2023-01-10 thomas (cd $testroot/repo && got diff -d -c $commit_id0 -c $commit_id1 alpha \
1525 e80ef83e 2023-01-10 thomas > $testroot/stdout)
1526 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1527 e80ef83e 2023-01-10 thomas ret=$?
1528 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1529 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1530 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1531 e80ef83e 2023-01-10 thomas return 1
1532 e80ef83e 2023-01-10 thomas fi
1533 e80ef83e 2023-01-10 thomas # same diffstat in work tree
1534 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got diff -d -c $commit_id0 -c $commit_id1 alpha \
1535 e80ef83e 2023-01-10 thomas > $testroot/stdout)
1536 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1537 e80ef83e 2023-01-10 thomas ret=$?
1538 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1539 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1540 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1541 e80ef83e 2023-01-10 thomas return 1
1542 e80ef83e 2023-01-10 thomas fi
1543 e80ef83e 2023-01-10 thomas
1544 e80ef83e 2023-01-10 thomas cat <<EOF >$testroot/stdout.expected
1545 e80ef83e 2023-01-10 thomas diffstat $commit_id0 $commit_id1
1546 e80ef83e 2023-01-10 thomas D beta | 0+ 1-
1547 e80ef83e 2023-01-10 thomas A new | 1+ 0-
1548 e80ef83e 2023-01-10 thomas
1549 28466fca 2023-01-19 thomas 2 files changed, 1 insertion(+), 1 deletion(-)
1550 e80ef83e 2023-01-10 thomas
1551 e80ef83e 2023-01-10 thomas EOF
1552 e80ef83e 2023-01-10 thomas
1553 e80ef83e 2023-01-10 thomas # same diffstat filtered by paths "beta" and "new"
1554 e80ef83e 2023-01-10 thomas echo "diff $commit_id0 $commit_id1" >> $testroot/stdout.expected
1555 e80ef83e 2023-01-10 thomas echo "commit - $commit_id0" >> $testroot/stdout.expected
1556 e80ef83e 2023-01-10 thomas echo "commit + $commit_id1" >> $testroot/stdout.expected
1557 e80ef83e 2023-01-10 thomas echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected
1558 e80ef83e 2023-01-10 thomas echo 'blob + /dev/null' >> $testroot/stdout.expected
1559 e80ef83e 2023-01-10 thomas echo '--- beta' >> $testroot/stdout.expected
1560 e80ef83e 2023-01-10 thomas echo '+++ /dev/null' >> $testroot/stdout.expected
1561 e80ef83e 2023-01-10 thomas echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1562 e80ef83e 2023-01-10 thomas echo '-beta' >> $testroot/stdout.expected
1563 e80ef83e 2023-01-10 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1564 e80ef83e 2023-01-10 thomas echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected
1565 e80ef83e 2023-01-10 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1566 e80ef83e 2023-01-10 thomas echo '+++ new' >> $testroot/stdout.expected
1567 e80ef83e 2023-01-10 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1568 e80ef83e 2023-01-10 thomas echo '+new file' >> $testroot/stdout.expected
1569 e80ef83e 2023-01-10 thomas (cd $testroot/repo && got diff -d -c $commit_id0 -c $commit_id1 \
1570 e80ef83e 2023-01-10 thomas beta new > $testroot/stdout)
1571 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1572 e80ef83e 2023-01-10 thomas ret=$?
1573 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1574 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1575 e80ef83e 2023-01-10 thomas fi
1576 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1577 e80ef83e 2023-01-10 thomas }
1578 e80ef83e 2023-01-10 thomas
1579 e80ef83e 2023-01-10 thomas test_diff_worktree_diffstat() {
1580 e80ef83e 2023-01-10 thomas local testroot=`test_init diff_worktree_diffstat`
1581 e80ef83e 2023-01-10 thomas local head_rev=`git_show_head $testroot/repo`
1582 e80ef83e 2023-01-10 thomas local alpha_blobid=`get_blob_id $testroot/repo "" alpha`
1583 e80ef83e 2023-01-10 thomas
1584 e80ef83e 2023-01-10 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1585 e80ef83e 2023-01-10 thomas ret=$?
1586 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1587 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1588 e80ef83e 2023-01-10 thomas return 1
1589 e80ef83e 2023-01-10 thomas fi
1590 e80ef83e 2023-01-10 thomas
1591 e80ef83e 2023-01-10 thomas echo "modified alpha" > $testroot/wt/alpha
1592 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got rm beta >/dev/null)
1593 e80ef83e 2023-01-10 thomas echo "new file" > $testroot/wt/new
1594 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got add new >/dev/null)
1595 e80ef83e 2023-01-10 thomas
1596 e80ef83e 2023-01-10 thomas cat <<EOF >$testroot/stdout.expected
1597 e80ef83e 2023-01-10 thomas diffstat $testroot/wt
1598 e80ef83e 2023-01-10 thomas M alpha | 1+ 1-
1599 e80ef83e 2023-01-10 thomas D beta | 0+ 1-
1600 e80ef83e 2023-01-10 thomas A new | 1+ 0-
1601 e80ef83e 2023-01-10 thomas
1602 e80ef83e 2023-01-10 thomas 3 files changed, 2 insertions(+), 2 deletions(-)
1603 e80ef83e 2023-01-10 thomas
1604 e80ef83e 2023-01-10 thomas EOF
1605 e80ef83e 2023-01-10 thomas
1606 e80ef83e 2023-01-10 thomas echo "diff $testroot/wt" >> $testroot/stdout.expected
1607 e80ef83e 2023-01-10 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
1608 e80ef83e 2023-01-10 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
1609 e80ef83e 2023-01-10 thomas echo -n 'blob - ' >> $testroot/stdout.expected
1610 e80ef83e 2023-01-10 thomas got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
1611 e80ef83e 2023-01-10 thomas >> $testroot/stdout.expected
1612 e80ef83e 2023-01-10 thomas echo 'file + alpha' >> $testroot/stdout.expected
1613 e80ef83e 2023-01-10 thomas echo '--- alpha' >> $testroot/stdout.expected
1614 e80ef83e 2023-01-10 thomas echo '+++ alpha' >> $testroot/stdout.expected
1615 e80ef83e 2023-01-10 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1616 e80ef83e 2023-01-10 thomas echo '-alpha' >> $testroot/stdout.expected
1617 e80ef83e 2023-01-10 thomas echo '+modified alpha' >> $testroot/stdout.expected
1618 e80ef83e 2023-01-10 thomas echo -n 'blob - ' >> $testroot/stdout.expected
1619 e80ef83e 2023-01-10 thomas got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1620 e80ef83e 2023-01-10 thomas >> $testroot/stdout.expected
1621 e80ef83e 2023-01-10 thomas echo 'file + /dev/null' >> $testroot/stdout.expected
1622 e80ef83e 2023-01-10 thomas echo '--- beta' >> $testroot/stdout.expected
1623 e80ef83e 2023-01-10 thomas echo '+++ /dev/null' >> $testroot/stdout.expected
1624 e80ef83e 2023-01-10 thomas echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1625 e80ef83e 2023-01-10 thomas echo '-beta' >> $testroot/stdout.expected
1626 e80ef83e 2023-01-10 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1627 e80ef83e 2023-01-10 thomas echo 'file + new (mode 644)' >> $testroot/stdout.expected
1628 e80ef83e 2023-01-10 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1629 e80ef83e 2023-01-10 thomas echo '+++ new' >> $testroot/stdout.expected
1630 e80ef83e 2023-01-10 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1631 e80ef83e 2023-01-10 thomas echo '+new file' >> $testroot/stdout.expected
1632 e80ef83e 2023-01-10 thomas
1633 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got diff -d > $testroot/stdout)
1634 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1635 e80ef83e 2023-01-10 thomas ret=$?
1636 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1637 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1638 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1639 e80ef83e 2023-01-10 thomas return 1
1640 e80ef83e 2023-01-10 thomas fi
1641 e80ef83e 2023-01-10 thomas
1642 e80ef83e 2023-01-10 thomas echo "modified zeta" > $testroot/wt/epsilon/zeta
1643 e80ef83e 2023-01-10 thomas
1644 e80ef83e 2023-01-10 thomas cat <<EOF >$testroot/stdout.expected
1645 e80ef83e 2023-01-10 thomas diffstat $testroot/wt
1646 e80ef83e 2023-01-10 thomas M alpha | 1+ 1-
1647 e80ef83e 2023-01-10 thomas D beta | 0+ 1-
1648 e80ef83e 2023-01-10 thomas M epsilon/zeta | 1+ 1-
1649 e80ef83e 2023-01-10 thomas A new | 1+ 0-
1650 e80ef83e 2023-01-10 thomas
1651 e80ef83e 2023-01-10 thomas 4 files changed, 3 insertions(+), 3 deletions(-)
1652 e80ef83e 2023-01-10 thomas
1653 e80ef83e 2023-01-10 thomas EOF
1654 e80ef83e 2023-01-10 thomas
1655 e80ef83e 2023-01-10 thomas # specify paths to diffstat
1656 e80ef83e 2023-01-10 thomas echo "diff $testroot/wt" >> $testroot/stdout.expected
1657 e80ef83e 2023-01-10 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
1658 e80ef83e 2023-01-10 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
1659 e80ef83e 2023-01-10 thomas echo -n 'blob - ' >> $testroot/stdout.expected
1660 e80ef83e 2023-01-10 thomas got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
1661 e80ef83e 2023-01-10 thomas >> $testroot/stdout.expected
1662 e80ef83e 2023-01-10 thomas echo 'file + alpha' >> $testroot/stdout.expected
1663 e80ef83e 2023-01-10 thomas echo '--- alpha' >> $testroot/stdout.expected
1664 e80ef83e 2023-01-10 thomas echo '+++ alpha' >> $testroot/stdout.expected
1665 e80ef83e 2023-01-10 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1666 e80ef83e 2023-01-10 thomas echo '-alpha' >> $testroot/stdout.expected
1667 e80ef83e 2023-01-10 thomas echo '+modified alpha' >> $testroot/stdout.expected
1668 e80ef83e 2023-01-10 thomas echo -n 'blob - ' >> $testroot/stdout.expected
1669 e80ef83e 2023-01-10 thomas got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
1670 e80ef83e 2023-01-10 thomas >> $testroot/stdout.expected
1671 e80ef83e 2023-01-10 thomas echo 'file + /dev/null' >> $testroot/stdout.expected
1672 e80ef83e 2023-01-10 thomas echo '--- beta' >> $testroot/stdout.expected
1673 e80ef83e 2023-01-10 thomas echo '+++ /dev/null' >> $testroot/stdout.expected
1674 e80ef83e 2023-01-10 thomas echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
1675 e80ef83e 2023-01-10 thomas echo '-beta' >> $testroot/stdout.expected
1676 e80ef83e 2023-01-10 thomas echo -n 'blob - ' >> $testroot/stdout.expected
1677 e80ef83e 2023-01-10 thomas got tree -r $testroot/repo -i epsilon | grep 'zeta$' | cut -d' ' -f 1 \
1678 e80ef83e 2023-01-10 thomas >> $testroot/stdout.expected
1679 e80ef83e 2023-01-10 thomas echo 'file + epsilon/zeta' >> $testroot/stdout.expected
1680 e80ef83e 2023-01-10 thomas echo '--- epsilon/zeta' >> $testroot/stdout.expected
1681 e80ef83e 2023-01-10 thomas echo '+++ epsilon/zeta' >> $testroot/stdout.expected
1682 e80ef83e 2023-01-10 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
1683 e80ef83e 2023-01-10 thomas echo '-zeta' >> $testroot/stdout.expected
1684 e80ef83e 2023-01-10 thomas echo '+modified zeta' >> $testroot/stdout.expected
1685 e80ef83e 2023-01-10 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1686 e80ef83e 2023-01-10 thomas echo 'file + new (mode 644)' >> $testroot/stdout.expected
1687 e80ef83e 2023-01-10 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1688 e80ef83e 2023-01-10 thomas echo '+++ new' >> $testroot/stdout.expected
1689 e80ef83e 2023-01-10 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1690 e80ef83e 2023-01-10 thomas echo '+new file' >> $testroot/stdout.expected
1691 e80ef83e 2023-01-10 thomas
1692 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got diff -d new alpha epsilon beta > $testroot/stdout)
1693 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1694 e80ef83e 2023-01-10 thomas ret=$?
1695 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1696 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1697 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1698 e80ef83e 2023-01-10 thomas return 1
1699 e80ef83e 2023-01-10 thomas fi
1700 e80ef83e 2023-01-10 thomas
1701 e80ef83e 2023-01-10 thomas # same diff irrespective of argument order
1702 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got diff -d alpha new epsilon beta \
1703 e80ef83e 2023-01-10 thomas > $testroot/stdout 2> $testroot/stderr)
1704 e80ef83e 2023-01-10 thomas ret=$?
1705 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1706 e80ef83e 2023-01-10 thomas echo "diff failed unexpectedly" >&2
1707 e80ef83e 2023-01-10 thomas test_done "$testroot" "1"
1708 e80ef83e 2023-01-10 thomas return 1
1709 e80ef83e 2023-01-10 thomas fi
1710 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1711 e80ef83e 2023-01-10 thomas ret=$?
1712 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1713 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1714 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1715 e80ef83e 2023-01-10 thomas return 1
1716 e80ef83e 2023-01-10 thomas fi
1717 e80ef83e 2023-01-10 thomas
1718 e80ef83e 2023-01-10 thomas # force paths with -P
1719 e80ef83e 2023-01-10 thomas echo master > $testroot/wt/master
1720 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got add master > /dev/null)
1721 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got diff -d -P new master > $testroot/stdout)
1722 e80ef83e 2023-01-10 thomas ret=$?
1723 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1724 e80ef83e 2023-01-10 thomas echo "diff failed unexpectedly" >&2
1725 e80ef83e 2023-01-10 thomas test_done "$testroot" "1"
1726 e80ef83e 2023-01-10 thomas return 1
1727 e80ef83e 2023-01-10 thomas fi
1728 e80ef83e 2023-01-10 thomas
1729 e80ef83e 2023-01-10 thomas cat <<EOF >$testroot/stdout.expected
1730 e80ef83e 2023-01-10 thomas diffstat $testroot/wt
1731 e80ef83e 2023-01-10 thomas A master | 1+ 0-
1732 e80ef83e 2023-01-10 thomas A new | 1+ 0-
1733 e80ef83e 2023-01-10 thomas
1734 e80ef83e 2023-01-10 thomas 2 files changed, 2 insertions(+), 0 deletions(-)
1735 e80ef83e 2023-01-10 thomas
1736 e80ef83e 2023-01-10 thomas EOF
1737 e80ef83e 2023-01-10 thomas
1738 e80ef83e 2023-01-10 thomas echo "diff $testroot/wt" >> $testroot/stdout.expected
1739 e80ef83e 2023-01-10 thomas echo "commit - $head_rev" >> $testroot/stdout.expected
1740 e80ef83e 2023-01-10 thomas echo "path + $testroot/wt" >> $testroot/stdout.expected
1741 e80ef83e 2023-01-10 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1742 e80ef83e 2023-01-10 thomas echo 'file + master (mode 644)' >> $testroot/stdout.expected
1743 e80ef83e 2023-01-10 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1744 e80ef83e 2023-01-10 thomas echo '+++ master' >> $testroot/stdout.expected
1745 e80ef83e 2023-01-10 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1746 e80ef83e 2023-01-10 thomas echo '+master' >> $testroot/stdout.expected
1747 e80ef83e 2023-01-10 thomas echo 'blob - /dev/null' >> $testroot/stdout.expected
1748 e80ef83e 2023-01-10 thomas echo 'file + new (mode 644)' >> $testroot/stdout.expected
1749 e80ef83e 2023-01-10 thomas echo '--- /dev/null' >> $testroot/stdout.expected
1750 e80ef83e 2023-01-10 thomas echo '+++ new' >> $testroot/stdout.expected
1751 e80ef83e 2023-01-10 thomas echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
1752 e80ef83e 2023-01-10 thomas echo '+new file' >> $testroot/stdout.expected
1753 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1754 e80ef83e 2023-01-10 thomas ret=$?
1755 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1756 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1757 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1758 e80ef83e 2023-01-10 thomas return 1
1759 e80ef83e 2023-01-10 thomas fi
1760 e80ef83e 2023-01-10 thomas
1761 e80ef83e 2023-01-10 thomas # diff two blob ids
1762 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got commit -m 'edit' alpha >/dev/null)
1763 e80ef83e 2023-01-10 thomas local alpha_new_blobid=`get_blob_id $testroot/repo "" alpha`
1764 e80ef83e 2023-01-10 thomas (cd $testroot/wt && got diff -d $alpha_blobid $alpha_new_blobid) \
1765 e80ef83e 2023-01-10 thomas > $testroot/stdout
1766 e80ef83e 2023-01-10 thomas ret=$?
1767 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1768 e80ef83e 2023-01-10 thomas echo "diff failed unexpectedly" >&2
1769 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1770 e80ef83e 2023-01-10 thomas return 1
1771 e80ef83e 2023-01-10 thomas fi
1772 e80ef83e 2023-01-10 thomas
1773 71d196c9 2023-01-19 thomas short_alpha_id=$(printf '%.10s' $alpha_blobid)
1774 71d196c9 2023-01-19 thomas short_alpha_new_id=$(printf '%.10s' $alpha_new_blobid)
1775 e80ef83e 2023-01-10 thomas cat <<EOF >$testroot/stdout.expected
1776 e80ef83e 2023-01-10 thomas diffstat $alpha_blobid $alpha_new_blobid
1777 e80ef83e 2023-01-10 thomas M $short_alpha_id -> $short_alpha_new_id | 1+ 1-
1778 e80ef83e 2023-01-10 thomas
1779 28466fca 2023-01-19 thomas 1 file changed, 1 insertion(+), 1 deletion(-)
1780 e80ef83e 2023-01-10 thomas
1781 e80ef83e 2023-01-10 thomas blob - $alpha_blobid
1782 e80ef83e 2023-01-10 thomas blob + $alpha_new_blobid
1783 e80ef83e 2023-01-10 thomas --- $alpha_blobid
1784 e80ef83e 2023-01-10 thomas +++ $alpha_new_blobid
1785 e80ef83e 2023-01-10 thomas @@ -1 +1 @@
1786 e80ef83e 2023-01-10 thomas -alpha
1787 e80ef83e 2023-01-10 thomas +modified alpha
1788 e80ef83e 2023-01-10 thomas EOF
1789 e80ef83e 2023-01-10 thomas
1790 e80ef83e 2023-01-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1791 e80ef83e 2023-01-10 thomas ret=$?
1792 e80ef83e 2023-01-10 thomas if [ $ret -ne 0 ]; then
1793 e80ef83e 2023-01-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1794 e4e80ba4 2023-03-01 thomas fi
1795 e4e80ba4 2023-03-01 thomas test_done "$testroot" "$ret"
1796 e4e80ba4 2023-03-01 thomas }
1797 e4e80ba4 2023-03-01 thomas
1798 e4e80ba4 2023-03-01 thomas test_diff_file_to_dir() {
1799 e4e80ba4 2023-03-01 thomas local testroot=`test_init diff_file_to_dir`
1800 e4e80ba4 2023-03-01 thomas local commit_id0=`git_show_head $testroot/repo`
1801 870ddae5 2023-03-10 thomas local alpha_blobid=`get_blob_id $testroot/repo "" alpha`
1802 e4e80ba4 2023-03-01 thomas
1803 e4e80ba4 2023-03-01 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1804 e4e80ba4 2023-03-01 thomas ret=$?
1805 e4e80ba4 2023-03-01 thomas if [ $ret -ne 0 ]; then
1806 e4e80ba4 2023-03-01 thomas test_done "$testroot" "$ret"
1807 e4e80ba4 2023-03-01 thomas return 1
1808 e4e80ba4 2023-03-01 thomas fi
1809 e4e80ba4 2023-03-01 thomas
1810 e4e80ba4 2023-03-01 thomas git_rm $testroot/repo alpha
1811 e4e80ba4 2023-03-01 thomas mkdir $testroot/repo/alpha
1812 e4e80ba4 2023-03-01 thomas echo eta > $testroot/repo/alpha/eta
1813 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add alpha/eta
1814 e4e80ba4 2023-03-01 thomas git_commit $testroot/repo -m "changed alpha into directory"
1815 e4e80ba4 2023-03-01 thomas local commit_id1=`git_show_head $testroot/repo`
1816 870ddae5 2023-03-10 thomas local alpha_eta_blobid=`get_blob_id $testroot/repo alpha eta`
1817 e4e80ba4 2023-03-01 thomas
1818 870ddae5 2023-03-10 thomas cat <<EOF >$testroot/stdout.expected
1819 870ddae5 2023-03-10 thomas diff $commit_id0 $commit_id1
1820 870ddae5 2023-03-10 thomas commit - $commit_id0
1821 870ddae5 2023-03-10 thomas commit + $commit_id1
1822 870ddae5 2023-03-10 thomas blob - $alpha_blobid (mode 644)
1823 870ddae5 2023-03-10 thomas blob + /dev/null
1824 870ddae5 2023-03-10 thomas --- alpha
1825 870ddae5 2023-03-10 thomas +++ /dev/null
1826 870ddae5 2023-03-10 thomas @@ -1 +0,0 @@
1827 870ddae5 2023-03-10 thomas -alpha
1828 870ddae5 2023-03-10 thomas blob - /dev/null
1829 870ddae5 2023-03-10 thomas blob + $alpha_eta_blobid (mode 644)
1830 870ddae5 2023-03-10 thomas --- /dev/null
1831 870ddae5 2023-03-10 thomas +++ alpha/eta
1832 870ddae5 2023-03-10 thomas @@ -0,0 +1 @@
1833 870ddae5 2023-03-10 thomas +eta
1834 870ddae5 2023-03-10 thomas EOF
1835 e4e80ba4 2023-03-01 thomas got diff -r $testroot/repo $commit_id0 $commit_id1 > $testroot/stdout
1836 870ddae5 2023-03-10 thomas ret=$?
1837 870ddae5 2023-03-10 thomas if [ $ret -ne 0 ]; then
1838 870ddae5 2023-03-10 thomas echo "diff failed unexpectedly" >&2
1839 870ddae5 2023-03-10 thomas test_done "$testroot" "1"
1840 870ddae5 2023-03-10 thomas return 1
1841 870ddae5 2023-03-10 thomas fi
1842 870ddae5 2023-03-10 thomas
1843 e4e80ba4 2023-03-01 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1844 e4e80ba4 2023-03-01 thomas ret=$?
1845 870ddae5 2023-03-10 thomas if [ $ret -ne 0 ]; then
1846 870ddae5 2023-03-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1847 870ddae5 2023-03-10 thomas test_done "$testroot" "$ret"
1848 870ddae5 2023-03-10 thomas return 1
1849 870ddae5 2023-03-10 thomas fi
1850 870ddae5 2023-03-10 thomas
1851 870ddae5 2023-03-10 thomas local author_time=`git_show_author_time $testroot/repo`
1852 870ddae5 2023-03-10 thomas d=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
1853 870ddae5 2023-03-10 thomas cat <<EOF >$testroot/stdout.expected
1854 870ddae5 2023-03-10 thomas -----------------------------------------------
1855 870ddae5 2023-03-10 thomas commit $commit_id1 (master)
1856 870ddae5 2023-03-10 thomas from: $GOT_AUTHOR
1857 870ddae5 2023-03-10 thomas date: $d
1858 870ddae5 2023-03-10 thomas
1859 870ddae5 2023-03-10 thomas changed alpha into directory
1860 870ddae5 2023-03-10 thomas
1861 870ddae5 2023-03-10 thomas D alpha
1862 870ddae5 2023-03-10 thomas A alpha/eta
1863 870ddae5 2023-03-10 thomas
1864 870ddae5 2023-03-10 thomas EOF
1865 870ddae5 2023-03-10 thomas
1866 870ddae5 2023-03-10 thomas got log -P -r $testroot/repo -l1 -c $commit_id1 > $testroot/stdout
1867 870ddae5 2023-03-10 thomas ret=$?
1868 870ddae5 2023-03-10 thomas if [ $ret -ne 0 ]; then
1869 870ddae5 2023-03-10 thomas echo "diff failed unexpectedly" >&2
1870 870ddae5 2023-03-10 thomas test_done "$testroot" "1"
1871 870ddae5 2023-03-10 thomas return 1
1872 e80ef83e 2023-01-10 thomas fi
1873 870ddae5 2023-03-10 thomas
1874 870ddae5 2023-03-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1875 870ddae5 2023-03-10 thomas ret=$?
1876 870ddae5 2023-03-10 thomas if [ $ret -ne 0 ]; then
1877 870ddae5 2023-03-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1878 870ddae5 2023-03-10 thomas fi
1879 e80ef83e 2023-01-10 thomas test_done "$testroot" "$ret"
1880 831297da 2022-07-26 thomas }
1881 831297da 2022-07-26 thomas
1882 870ddae5 2023-03-10 thomas test_diff_dir_to_file() {
1883 870ddae5 2023-03-10 thomas local testroot=`test_init diff_file_to_dir`
1884 870ddae5 2023-03-10 thomas local commit_id0=`git_show_head $testroot/repo`
1885 870ddae5 2023-03-10 thomas local epsilon_zeta_blobid=`get_blob_id $testroot/repo epsilon zeta`
1886 870ddae5 2023-03-10 thomas
1887 870ddae5 2023-03-10 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1888 870ddae5 2023-03-10 thomas ret=$?
1889 870ddae5 2023-03-10 thomas if [ $ret -ne 0 ]; then
1890 870ddae5 2023-03-10 thomas test_done "$testroot" "$ret"
1891 870ddae5 2023-03-10 thomas return 1
1892 870ddae5 2023-03-10 thomas fi
1893 870ddae5 2023-03-10 thomas
1894 870ddae5 2023-03-10 thomas git_rmdir $testroot/repo epsilon
1895 870ddae5 2023-03-10 thomas echo epsilon > $testroot/repo/epsilon
1896 d1e03b8c 2023-10-08 thomas git -C $testroot/repo add epsilon
1897 870ddae5 2023-03-10 thomas git_commit $testroot/repo -m "changed epsilon into file"
1898 870ddae5 2023-03-10 thomas local commit_id1=`git_show_head $testroot/repo`
1899 870ddae5 2023-03-10 thomas local epsilon_blobid=`get_blob_id $testroot/repo "" epsilon`
1900 870ddae5 2023-03-10 thomas
1901 870ddae5 2023-03-10 thomas cat <<EOF >$testroot/stdout.expected
1902 870ddae5 2023-03-10 thomas diff $commit_id0 $commit_id1
1903 870ddae5 2023-03-10 thomas commit - $commit_id0
1904 870ddae5 2023-03-10 thomas commit + $commit_id1
1905 870ddae5 2023-03-10 thomas blob - $epsilon_zeta_blobid (mode 644)
1906 870ddae5 2023-03-10 thomas blob + /dev/null
1907 870ddae5 2023-03-10 thomas --- epsilon/zeta
1908 870ddae5 2023-03-10 thomas +++ /dev/null
1909 870ddae5 2023-03-10 thomas @@ -1 +0,0 @@
1910 870ddae5 2023-03-10 thomas -zeta
1911 870ddae5 2023-03-10 thomas blob - /dev/null
1912 870ddae5 2023-03-10 thomas blob + $epsilon_blobid (mode 644)
1913 870ddae5 2023-03-10 thomas --- /dev/null
1914 870ddae5 2023-03-10 thomas +++ epsilon
1915 870ddae5 2023-03-10 thomas @@ -0,0 +1 @@
1916 870ddae5 2023-03-10 thomas +epsilon
1917 870ddae5 2023-03-10 thomas EOF
1918 870ddae5 2023-03-10 thomas got diff -r $testroot/repo $commit_id0 $commit_id1 > $testroot/stdout
1919 870ddae5 2023-03-10 thomas ret=$?
1920 870ddae5 2023-03-10 thomas if [ $ret -ne 0 ]; then
1921 870ddae5 2023-03-10 thomas echo "diff failed unexpectedly" >&2
1922 870ddae5 2023-03-10 thomas test_done "$testroot" "1"
1923 870ddae5 2023-03-10 thomas return 1
1924 870ddae5 2023-03-10 thomas fi
1925 870ddae5 2023-03-10 thomas
1926 870ddae5 2023-03-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1927 870ddae5 2023-03-10 thomas ret=$?
1928 870ddae5 2023-03-10 thomas if [ $ret -ne 0 ]; then
1929 870ddae5 2023-03-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1930 870ddae5 2023-03-10 thomas test_done "$testroot" "$ret"
1931 870ddae5 2023-03-10 thomas return 1
1932 870ddae5 2023-03-10 thomas fi
1933 870ddae5 2023-03-10 thomas
1934 870ddae5 2023-03-10 thomas local author_time=`git_show_author_time $testroot/repo`
1935 870ddae5 2023-03-10 thomas d=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
1936 870ddae5 2023-03-10 thomas cat <<EOF >$testroot/stdout.expected
1937 870ddae5 2023-03-10 thomas -----------------------------------------------
1938 870ddae5 2023-03-10 thomas commit $commit_id1 (master)
1939 870ddae5 2023-03-10 thomas from: $GOT_AUTHOR
1940 870ddae5 2023-03-10 thomas date: $d
1941 870ddae5 2023-03-10 thomas
1942 870ddae5 2023-03-10 thomas changed epsilon into file
1943 870ddae5 2023-03-10 thomas
1944 870ddae5 2023-03-10 thomas D epsilon/zeta
1945 870ddae5 2023-03-10 thomas A epsilon
1946 870ddae5 2023-03-10 thomas
1947 870ddae5 2023-03-10 thomas EOF
1948 870ddae5 2023-03-10 thomas
1949 870ddae5 2023-03-10 thomas got log -P -r $testroot/repo -l1 -c $commit_id1 > $testroot/stdout
1950 870ddae5 2023-03-10 thomas ret=$?
1951 870ddae5 2023-03-10 thomas if [ $ret -ne 0 ]; then
1952 870ddae5 2023-03-10 thomas echo "diff failed unexpectedly" >&2
1953 870ddae5 2023-03-10 thomas test_done "$testroot" "1"
1954 870ddae5 2023-03-10 thomas return 1
1955 870ddae5 2023-03-10 thomas fi
1956 870ddae5 2023-03-10 thomas
1957 870ddae5 2023-03-10 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1958 870ddae5 2023-03-10 thomas ret=$?
1959 870ddae5 2023-03-10 thomas if [ $ret -ne 0 ]; then
1960 870ddae5 2023-03-10 thomas diff -u $testroot/stdout.expected $testroot/stdout
1961 870ddae5 2023-03-10 thomas fi
1962 870ddae5 2023-03-10 thomas test_done "$testroot" "$ret"
1963 870ddae5 2023-03-10 thomas }
1964 64592dff 2023-06-08 thomas
1965 64592dff 2023-06-08 thomas test_diff_path_in_root_commit() {
1966 64592dff 2023-06-08 thomas local testroot=`test_init diff_path_in_root_commit`
1967 64592dff 2023-06-08 thomas local commit_id=`git_show_head $testroot/repo`
1968 64592dff 2023-06-08 thomas local alpha_blobid=`get_blob_id $testroot/repo "" alpha`
1969 64592dff 2023-06-08 thomas
1970 64592dff 2023-06-08 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1971 64592dff 2023-06-08 thomas ret=$?
1972 64592dff 2023-06-08 thomas if [ $ret -ne 0 ]; then
1973 64592dff 2023-06-08 thomas test_done "$testroot" "$ret"
1974 64592dff 2023-06-08 thomas return 1
1975 64592dff 2023-06-08 thomas fi
1976 64592dff 2023-06-08 thomas
1977 64592dff 2023-06-08 thomas (cd $testroot/wt && got diff -c $commit_id alpha > $testroot/stdout)
1978 64592dff 2023-06-08 thomas
1979 64592dff 2023-06-08 thomas cat <<EOF >$testroot/stdout.expected
1980 64592dff 2023-06-08 thomas diff /dev/null $commit_id
1981 64592dff 2023-06-08 thomas commit - /dev/null
1982 64592dff 2023-06-08 thomas commit + $commit_id
1983 64592dff 2023-06-08 thomas blob - /dev/null
1984 64592dff 2023-06-08 thomas blob + $alpha_blobid (mode 644)
1985 64592dff 2023-06-08 thomas --- /dev/null
1986 64592dff 2023-06-08 thomas +++ alpha
1987 64592dff 2023-06-08 thomas @@ -0,0 +1 @@
1988 64592dff 2023-06-08 thomas +alpha
1989 64592dff 2023-06-08 thomas EOF
1990 870ddae5 2023-03-10 thomas
1991 64592dff 2023-06-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1992 64592dff 2023-06-08 thomas ret=$?
1993 64592dff 2023-06-08 thomas if [ $ret -ne 0 ]; then
1994 64592dff 2023-06-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
1995 64592dff 2023-06-08 thomas test_done "$testroot" "$ret"
1996 64592dff 2023-06-08 thomas return 1
1997 64592dff 2023-06-08 thomas fi
1998 64592dff 2023-06-08 thomas
1999 64592dff 2023-06-08 thomas # diff non-existent path
2000 64592dff 2023-06-08 thomas (cd $testroot/wt && got diff -c $commit_id nonexistent \
2001 64592dff 2023-06-08 thomas > $testroot/stdout 2> $testroot/stderr)
2002 64592dff 2023-06-08 thomas
2003 64592dff 2023-06-08 thomas echo -n > $testroot/stdout.expected
2004 64592dff 2023-06-08 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2005 64592dff 2023-06-08 thomas ret=$?
2006 64592dff 2023-06-08 thomas if [ $ret -ne 0 ]; then
2007 64592dff 2023-06-08 thomas diff -u $testroot/stdout.expected $testroot/stdout
2008 64592dff 2023-06-08 thomas test_done "$testroot" "$ret"
2009 64592dff 2023-06-08 thomas return 1
2010 64592dff 2023-06-08 thomas fi
2011 64592dff 2023-06-08 thomas
2012 64592dff 2023-06-08 thomas echo "got: nonexistent: no such entry found in tree" \
2013 64592dff 2023-06-08 thomas > $testroot/stderr.expected
2014 64592dff 2023-06-08 thomas cmp -s $testroot/stderr.expected $testroot/stderr
2015 64592dff 2023-06-08 thomas ret=$?
2016 64592dff 2023-06-08 thomas if [ $ret -ne 0 ]; then
2017 64592dff 2023-06-08 thomas diff -u $testroot/stderr.expected $testroot/stderr
2018 64592dff 2023-06-08 thomas test_done "$testroot" "$ret"
2019 64592dff 2023-06-08 thomas return 1
2020 64592dff 2023-06-08 thomas fi
2021 64592dff 2023-06-08 thomas
2022 64592dff 2023-06-08 thomas test_done "$testroot" "$ret"
2023 64592dff 2023-06-08 thomas }
2024 9139e004 2023-07-17 thomas
2025 9139e004 2023-07-17 thomas test_diff_commit_keywords() {
2026 9139e004 2023-07-17 thomas local testroot=`test_init diff_commit_keywords`
2027 8642913b 2023-07-26 thomas local repo="$testroot/repo"
2028 8642913b 2023-07-26 thomas local wt="$testroot/wt"
2029 9139e004 2023-07-17 thomas
2030 9139e004 2023-07-17 thomas got checkout $testroot/repo $testroot/wt > /dev/null
2031 9139e004 2023-07-17 thomas ret=$?
2032 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2033 9139e004 2023-07-17 thomas echo "checkout failed unexpectedly" >&2
2034 9139e004 2023-07-17 thomas test_done "$testroot" "$ret"
2035 9139e004 2023-07-17 thomas return 1
2036 9139e004 2023-07-17 thomas fi
2037 9139e004 2023-07-17 thomas
2038 8642913b 2023-07-26 thomas set -- "$(git_show_head $repo)"
2039 8642913b 2023-07-26 thomas local alpha_ids="$(get_blob_id "$repo" "" alpha)"
2040 8642913b 2023-07-26 thomas local beta_ids="$(get_blob_id "$repo" "" beta)"
2041 9139e004 2023-07-17 thomas
2042 9139e004 2023-07-17 thomas for i in `seq 8`; do
2043 9139e004 2023-07-17 thomas if [ $(( i % 2 )) -eq 0 ]; then
2044 9139e004 2023-07-17 thomas echo "alpha change $i" > "$testroot/wt/alpha"
2045 9139e004 2023-07-17 thomas else
2046 9139e004 2023-07-17 thomas echo "beta change $i" > "$testroot/wt/beta"
2047 9139e004 2023-07-17 thomas fi
2048 9139e004 2023-07-17 thomas
2049 9139e004 2023-07-17 thomas (cd "$testroot/wt" && got ci -m "commit number $i" > /dev/null)
2050 9139e004 2023-07-17 thomas ret=$?
2051 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2052 9139e004 2023-07-17 thomas echo "commit failed unexpectedly" >&2
2053 9139e004 2023-07-17 thomas test_done "$testroot" "$ret"
2054 9139e004 2023-07-17 thomas return 1
2055 9139e004 2023-07-17 thomas fi
2056 9139e004 2023-07-17 thomas
2057 9139e004 2023-07-17 thomas if [ $(( i % 2 )) -eq 0 ]; then
2058 8642913b 2023-07-26 thomas alpha_ids="$alpha_ids $(get_blob_id "$repo" "" alpha)"
2059 9139e004 2023-07-17 thomas else
2060 8642913b 2023-07-26 thomas beta_ids="$beta_ids $(get_blob_id "$repo" "" beta)"
2061 9139e004 2023-07-17 thomas fi
2062 9139e004 2023-07-17 thomas
2063 8642913b 2023-07-26 thomas set -- "$@" "$(git_show_head $repo)"
2064 9139e004 2023-07-17 thomas done
2065 9139e004 2023-07-17 thomas
2066 8642913b 2023-07-26 thomas echo "diff $(pop_idx 7 $@) $(pop_idx 8 $@)" > \
2067 9139e004 2023-07-17 thomas $testroot/stdout.expected
2068 8642913b 2023-07-26 thomas echo "commit - $(pop_idx 7 $@)" >> $testroot/stdout.expected
2069 8642913b 2023-07-26 thomas echo "commit + $(pop_idx 8 $@)" >> $testroot/stdout.expected
2070 8642913b 2023-07-26 thomas echo "blob - $(pop_idx 4 $beta_ids)" >> $testroot/stdout.expected
2071 8642913b 2023-07-26 thomas echo "blob + $(pop_idx 5 $beta_ids)" >> $testroot/stdout.expected
2072 9139e004 2023-07-17 thomas echo '--- beta' >> $testroot/stdout.expected
2073 9139e004 2023-07-17 thomas echo '+++ beta' >> $testroot/stdout.expected
2074 9139e004 2023-07-17 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2075 9139e004 2023-07-17 thomas echo '-beta change 5' >> $testroot/stdout.expected
2076 9139e004 2023-07-17 thomas echo '+beta change 7' >> $testroot/stdout.expected
2077 9139e004 2023-07-17 thomas
2078 9139e004 2023-07-17 thomas (cd $testroot/wt && got diff -cmaster:- > $testroot/stdout)
2079 9139e004 2023-07-17 thomas ret=$?
2080 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2081 9139e004 2023-07-17 thomas echo "diff failed unexpectedly" >&2
2082 9139e004 2023-07-17 thomas test_done "$testroot" "1"
2083 9139e004 2023-07-17 thomas return 1
2084 9139e004 2023-07-17 thomas fi
2085 64592dff 2023-06-08 thomas
2086 9139e004 2023-07-17 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2087 9139e004 2023-07-17 thomas ret=$?
2088 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2089 9139e004 2023-07-17 thomas diff -u $testroot/stdout.expected $testroot/stdout
2090 9139e004 2023-07-17 thomas test_done "$testroot" "$ret"
2091 9139e004 2023-07-17 thomas return 1
2092 9139e004 2023-07-17 thomas fi
2093 9139e004 2023-07-17 thomas
2094 9139e004 2023-07-17 thomas (cd $testroot/wt && got update -c:head:-6 > /dev/null)
2095 9139e004 2023-07-17 thomas ret=$?
2096 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2097 9139e004 2023-07-17 thomas echo "update failed unexpectedly" >&2
2098 9139e004 2023-07-17 thomas test_done "$testroot" "1"
2099 9139e004 2023-07-17 thomas return 1
2100 9139e004 2023-07-17 thomas fi
2101 9139e004 2023-07-17 thomas
2102 8642913b 2023-07-26 thomas echo "diff $(pop_idx 1 $@) $(pop_idx 2 $@)" > \
2103 9139e004 2023-07-17 thomas $testroot/stdout.expected
2104 8642913b 2023-07-26 thomas echo "commit - $(pop_idx 1 $@)" >> $testroot/stdout.expected
2105 8642913b 2023-07-26 thomas echo "commit + $(pop_idx 2 $@)" >> $testroot/stdout.expected
2106 8642913b 2023-07-26 thomas echo "blob - $(pop_idx 1 $beta_ids)" >> $testroot/stdout.expected
2107 8642913b 2023-07-26 thomas echo "blob + $(pop_idx 2 $beta_ids)" >> $testroot/stdout.expected
2108 9139e004 2023-07-17 thomas echo '--- beta' >> $testroot/stdout.expected
2109 9139e004 2023-07-17 thomas echo '+++ beta' >> $testroot/stdout.expected
2110 9139e004 2023-07-17 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2111 9139e004 2023-07-17 thomas echo '-beta' >> $testroot/stdout.expected
2112 9139e004 2023-07-17 thomas echo '+beta change 1' >> $testroot/stdout.expected
2113 9139e004 2023-07-17 thomas
2114 9139e004 2023-07-17 thomas (cd $testroot/wt && got diff -c:base:- > $testroot/stdout)
2115 9139e004 2023-07-17 thomas ret=$?
2116 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2117 9139e004 2023-07-17 thomas echo "diff failed unexpectedly" >&2
2118 9139e004 2023-07-17 thomas test_done "$testroot" "1"
2119 9139e004 2023-07-17 thomas return 1
2120 9139e004 2023-07-17 thomas fi
2121 9139e004 2023-07-17 thomas
2122 9139e004 2023-07-17 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2123 9139e004 2023-07-17 thomas ret=$?
2124 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2125 9139e004 2023-07-17 thomas diff -u $testroot/stdout.expected $testroot/stdout
2126 9139e004 2023-07-17 thomas test_done "$testroot" "$ret"
2127 9139e004 2023-07-17 thomas return 1
2128 9139e004 2023-07-17 thomas fi
2129 9139e004 2023-07-17 thomas
2130 8642913b 2023-07-26 thomas echo "diff $(pop_idx 3 $@) $(pop_idx 4 $@)" > \
2131 9139e004 2023-07-17 thomas $testroot/stdout.expected
2132 8642913b 2023-07-26 thomas echo "commit - $(pop_idx 3 $@)" >> $testroot/stdout.expected
2133 8642913b 2023-07-26 thomas echo "commit + $(pop_idx 4 $@)" >> $testroot/stdout.expected
2134 8642913b 2023-07-26 thomas echo "blob - $(pop_idx 2 $beta_ids)" >> $testroot/stdout.expected
2135 8642913b 2023-07-26 thomas echo "blob + $(pop_idx 3 $beta_ids)" >> $testroot/stdout.expected
2136 9139e004 2023-07-17 thomas echo '--- beta' >> $testroot/stdout.expected
2137 9139e004 2023-07-17 thomas echo '+++ beta' >> $testroot/stdout.expected
2138 9139e004 2023-07-17 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2139 9139e004 2023-07-17 thomas echo '-beta change 1' >> $testroot/stdout.expected
2140 9139e004 2023-07-17 thomas echo '+beta change 3' >> $testroot/stdout.expected
2141 9139e004 2023-07-17 thomas
2142 9139e004 2023-07-17 thomas (cd $testroot/wt && got diff -c:base:+ > $testroot/stdout)
2143 9139e004 2023-07-17 thomas ret=$?
2144 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2145 9139e004 2023-07-17 thomas echo "diff failed unexpectedly" >&2
2146 9139e004 2023-07-17 thomas test_done "$testroot" "1"
2147 9139e004 2023-07-17 thomas return 1
2148 9139e004 2023-07-17 thomas fi
2149 9139e004 2023-07-17 thomas
2150 9139e004 2023-07-17 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2151 9139e004 2023-07-17 thomas ret=$?
2152 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2153 9139e004 2023-07-17 thomas diff -u $testroot/stdout.expected $testroot/stdout
2154 9139e004 2023-07-17 thomas test_done "$testroot" "$ret"
2155 9139e004 2023-07-17 thomas return 1
2156 9139e004 2023-07-17 thomas fi
2157 9139e004 2023-07-17 thomas
2158 9139e004 2023-07-17 thomas # if modifier extends beyond HEAD, we should use HEAD ref
2159 8642913b 2023-07-26 thomas echo "diff $(pop_idx 8 $@) $(pop_idx 9 $@)" > \
2160 9139e004 2023-07-17 thomas $testroot/stdout.expected
2161 8642913b 2023-07-26 thomas echo "commit - $(pop_idx 8 $@)" >> $testroot/stdout.expected
2162 8642913b 2023-07-26 thomas echo "commit + $(pop_idx 9 $@)" >> $testroot/stdout.expected
2163 8642913b 2023-07-26 thomas echo "blob - $(pop_idx 4 $alpha_ids)" >> $testroot/stdout.expected
2164 8642913b 2023-07-26 thomas echo "blob + $(pop_idx 5 $alpha_ids)" >> $testroot/stdout.expected
2165 9139e004 2023-07-17 thomas echo '--- alpha' >> $testroot/stdout.expected
2166 9139e004 2023-07-17 thomas echo '+++ alpha' >> $testroot/stdout.expected
2167 9139e004 2023-07-17 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2168 9139e004 2023-07-17 thomas echo '-alpha change 6' >> $testroot/stdout.expected
2169 9139e004 2023-07-17 thomas echo '+alpha change 8' >> $testroot/stdout.expected
2170 9139e004 2023-07-17 thomas
2171 9139e004 2023-07-17 thomas (cd $testroot/wt && got diff -c:base:+20 > $testroot/stdout)
2172 9139e004 2023-07-17 thomas ret=$?
2173 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2174 9139e004 2023-07-17 thomas echo "diff failed unexpectedly" >&2
2175 9139e004 2023-07-17 thomas test_done "$testroot" "1"
2176 9139e004 2023-07-17 thomas return 1
2177 9139e004 2023-07-17 thomas fi
2178 9139e004 2023-07-17 thomas
2179 9139e004 2023-07-17 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2180 9139e004 2023-07-17 thomas ret=$?
2181 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2182 9139e004 2023-07-17 thomas diff -u $testroot/stdout.expected $testroot/stdout
2183 9139e004 2023-07-17 thomas test_done "$testroot" "$ret"
2184 9139e004 2023-07-17 thomas return 1
2185 9139e004 2023-07-17 thomas fi
2186 9139e004 2023-07-17 thomas
2187 8642913b 2023-07-26 thomas echo "diff $(pop_idx 3 $@) $(pop_idx 9 $@)" > \
2188 9139e004 2023-07-17 thomas $testroot/stdout.expected
2189 8642913b 2023-07-26 thomas echo "commit - $(pop_idx 3 $@)" >> $testroot/stdout.expected
2190 8642913b 2023-07-26 thomas echo "commit + $(pop_idx 9 $@)" >> $testroot/stdout.expected
2191 8642913b 2023-07-26 thomas echo "blob - $(pop_idx 2 $alpha_ids)" >> $testroot/stdout.expected
2192 8642913b 2023-07-26 thomas echo "blob + $(pop_idx 5 $alpha_ids)" >> $testroot/stdout.expected
2193 9139e004 2023-07-17 thomas echo '--- alpha' >> $testroot/stdout.expected
2194 9139e004 2023-07-17 thomas echo '+++ alpha' >> $testroot/stdout.expected
2195 9139e004 2023-07-17 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2196 9139e004 2023-07-17 thomas echo '-alpha change 2' >> $testroot/stdout.expected
2197 9139e004 2023-07-17 thomas echo '+alpha change 8' >> $testroot/stdout.expected
2198 8642913b 2023-07-26 thomas echo "blob - $(pop_idx 2 $beta_ids)" >> $testroot/stdout.expected
2199 8642913b 2023-07-26 thomas echo "blob + $(pop_idx 5 $beta_ids)" >> $testroot/stdout.expected
2200 9139e004 2023-07-17 thomas echo '--- beta' >> $testroot/stdout.expected
2201 9139e004 2023-07-17 thomas echo '+++ beta' >> $testroot/stdout.expected
2202 9139e004 2023-07-17 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2203 9139e004 2023-07-17 thomas echo '-beta change 1' >> $testroot/stdout.expected
2204 9139e004 2023-07-17 thomas echo '+beta change 7' >> $testroot/stdout.expected
2205 9139e004 2023-07-17 thomas
2206 9139e004 2023-07-17 thomas (cd $testroot/wt && got diff -c:base -c:head > $testroot/stdout)
2207 9139e004 2023-07-17 thomas ret=$?
2208 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2209 9139e004 2023-07-17 thomas echo "diff failed unexpectedly" >&2
2210 9139e004 2023-07-17 thomas test_done "$testroot" "1"
2211 9139e004 2023-07-17 thomas return 1
2212 9139e004 2023-07-17 thomas fi
2213 9139e004 2023-07-17 thomas
2214 9139e004 2023-07-17 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2215 9139e004 2023-07-17 thomas ret=$?
2216 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2217 9139e004 2023-07-17 thomas diff -u $testroot/stdout.expected $testroot/stdout
2218 9139e004 2023-07-17 thomas test_done "$testroot" "$ret"
2219 9139e004 2023-07-17 thomas return 1
2220 9139e004 2023-07-17 thomas fi
2221 9139e004 2023-07-17 thomas
2222 8642913b 2023-07-26 thomas echo "diff $(pop_idx 6 $@) $(pop_idx 8 $@)" > \
2223 9139e004 2023-07-17 thomas $testroot/stdout.expected
2224 8642913b 2023-07-26 thomas echo "commit - $(pop_idx 6 $@)" >> $testroot/stdout.expected
2225 8642913b 2023-07-26 thomas echo "commit + $(pop_idx 8 $@)" >> $testroot/stdout.expected
2226 8642913b 2023-07-26 thomas echo "blob - $(pop_idx 3 $alpha_ids)" >> $testroot/stdout.expected
2227 8642913b 2023-07-26 thomas echo "blob + $(pop_idx 4 $alpha_ids)" >> $testroot/stdout.expected
2228 9139e004 2023-07-17 thomas echo '--- alpha' >> $testroot/stdout.expected
2229 9139e004 2023-07-17 thomas echo '+++ alpha' >> $testroot/stdout.expected
2230 9139e004 2023-07-17 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2231 9139e004 2023-07-17 thomas echo '-alpha change 4' >> $testroot/stdout.expected
2232 9139e004 2023-07-17 thomas echo '+alpha change 6' >> $testroot/stdout.expected
2233 8642913b 2023-07-26 thomas echo "blob - $(pop_idx 4 $beta_ids)" >> $testroot/stdout.expected
2234 8642913b 2023-07-26 thomas echo "blob + $(pop_idx 5 $beta_ids)" >> $testroot/stdout.expected
2235 9139e004 2023-07-17 thomas echo '--- beta' >> $testroot/stdout.expected
2236 9139e004 2023-07-17 thomas echo '+++ beta' >> $testroot/stdout.expected
2237 9139e004 2023-07-17 thomas echo '@@ -1 +1 @@' >> $testroot/stdout.expected
2238 9139e004 2023-07-17 thomas echo '-beta change 5' >> $testroot/stdout.expected
2239 9139e004 2023-07-17 thomas echo '+beta change 7' >> $testroot/stdout.expected
2240 9139e004 2023-07-17 thomas
2241 9139e004 2023-07-17 thomas got diff -r "$testroot/repo" -cmaster:-3 -c:head:-1 > $testroot/stdout
2242 9139e004 2023-07-17 thomas ret=$?
2243 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2244 9139e004 2023-07-17 thomas echo "diff failed unexpectedly" >&2
2245 9139e004 2023-07-17 thomas test_done "$testroot" "1"
2246 9139e004 2023-07-17 thomas return 1
2247 9139e004 2023-07-17 thomas fi
2248 9139e004 2023-07-17 thomas
2249 9139e004 2023-07-17 thomas cmp -s $testroot/stdout.expected $testroot/stdout
2250 9139e004 2023-07-17 thomas ret=$?
2251 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2252 9139e004 2023-07-17 thomas diff -u $testroot/stdout.expected $testroot/stdout
2253 9139e004 2023-07-17 thomas test_done "$testroot" "$ret"
2254 9139e004 2023-07-17 thomas return 1
2255 9139e004 2023-07-17 thomas fi
2256 9139e004 2023-07-17 thomas
2257 947f374d 2023-08-08 thomas echo "got: '-c :base' requires work tree" > "$testroot/stderr.expected"
2258 9139e004 2023-07-17 thomas
2259 9139e004 2023-07-17 thomas got diff -r "$testroot/repo" -c:base -c:head 2> $testroot/stderr
2260 9139e004 2023-07-17 thomas
2261 947f374d 2023-08-08 thomas cmp -s $testroot/stderr.expected $testroot/stderr
2262 9139e004 2023-07-17 thomas ret=$?
2263 9139e004 2023-07-17 thomas if [ $ret -ne 0 ]; then
2264 947f374d 2023-08-08 thomas diff -u $testroot/stderr.expected $testroot/stderr
2265 9139e004 2023-07-17 thomas fi
2266 9139e004 2023-07-17 thomas
2267 9139e004 2023-07-17 thomas test_done "$testroot" "$ret"
2268 9139e004 2023-07-17 thomas }
2269 9139e004 2023-07-17 thomas
2270 7fb414ae 2020-08-08 stsp test_parseargs "$@"
2271 95adcdca 2019-03-27 stsp run_test test_diff_basic
2272 95adcdca 2019-03-27 stsp run_test test_diff_shows_conflict
2273 d24820bf 2019-08-11 stsp run_test test_diff_tag
2274 562580bc 2020-01-14 stsp run_test test_diff_lightweight_tag
2275 63035f9f 2019-10-06 stsp run_test test_diff_ignore_whitespace
2276 e7303626 2020-05-14 stsp run_test test_diff_submodule_of_same_repo
2277 39449a05 2020-07-23 stsp run_test test_diff_symlinks_in_work_tree
2278 40dde666 2020-07-23 stsp run_test test_diff_symlinks_in_repo
2279 dffd0deb 2020-11-20 stsp run_test test_diff_binary_files
2280 cc8021af 2021-10-12 thomas run_test test_diff_commits
2281 47d17b68 2022-02-12 thomas run_test test_diff_ignored_file
2282 831297da 2022-07-26 thomas run_test test_diff_crlf
2283 6d054bb9 2022-09-23 thomas run_test test_diff_worktree_newfile_xbit
2284 e80ef83e 2023-01-10 thomas run_test test_diff_commit_diffstat
2285 e80ef83e 2023-01-10 thomas run_test test_diff_worktree_diffstat
2286 e4e80ba4 2023-03-01 thomas run_test test_diff_file_to_dir
2287 870ddae5 2023-03-10 thomas run_test test_diff_dir_to_file
2288 64592dff 2023-06-08 thomas run_test test_diff_path_in_root_commit
2289 9139e004 2023-07-17 thomas run_test test_diff_commit_keywords