Blame


1 c5f4d357 2023-04-22 thomas #!/bin/sh
2 c5f4d357 2023-04-22 thomas #
3 c5f4d357 2023-04-22 thomas # Copyright (c) 2023 Mark Jamsek <mark@jamsek.dev>
4 c5f4d357 2023-04-22 thomas #
5 c5f4d357 2023-04-22 thomas # Permission to use, copy, modify, and distribute this software for any
6 c5f4d357 2023-04-22 thomas # purpose with or without fee is hereby granted, provided that the above
7 c5f4d357 2023-04-22 thomas # copyright notice and this permission notice appear in all copies.
8 c5f4d357 2023-04-22 thomas #
9 c5f4d357 2023-04-22 thomas # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 c5f4d357 2023-04-22 thomas # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 c5f4d357 2023-04-22 thomas # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 c5f4d357 2023-04-22 thomas # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 c5f4d357 2023-04-22 thomas # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 c5f4d357 2023-04-22 thomas # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 c5f4d357 2023-04-22 thomas # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 c5f4d357 2023-04-22 thomas
17 c5f4d357 2023-04-22 thomas . ./common.sh
18 c5f4d357 2023-04-22 thomas
19 c5f4d357 2023-04-22 thomas test_diff_contiguous_commits()
20 c5f4d357 2023-04-22 thomas {
21 c5f4d357 2023-04-22 thomas test_init diff_contiguous_commits
22 c5f4d357 2023-04-22 thomas
23 c5f4d357 2023-04-22 thomas local commit_id1=`git_show_head $testroot/repo`
24 c5f4d357 2023-04-22 thomas local alpha_id_old=`get_blob_id $testroot/repo "" alpha`
25 c5f4d357 2023-04-22 thomas
26 c5f4d357 2023-04-22 thomas echo "modified alpha" > $testroot/repo/alpha
27 c5f4d357 2023-04-22 thomas git_commit $testroot/repo -m "changed alpha"
28 c5f4d357 2023-04-22 thomas local author_time=`git_show_author_time $testroot/repo`
29 c5f4d357 2023-04-22 thomas local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
30 c5f4d357 2023-04-22 thomas local head_id=`git_show_head $testroot/repo`
31 c5f4d357 2023-04-22 thomas local head_id_truncated=`trim_obj_id 13 $head_id`
32 c5f4d357 2023-04-22 thomas local alpha_id=`get_blob_id $testroot/repo "" alpha`
33 c5f4d357 2023-04-22 thomas
34 fa9bb690 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
35 c5f4d357 2023-04-22 thomas SCREENDUMP
36 c5f4d357 2023-04-22 thomas EOF
37 c5f4d357 2023-04-22 thomas
38 c5f4d357 2023-04-22 thomas cat <<EOF >$testroot/view.expected
39 c5f4d357 2023-04-22 thomas [1/20] diff $commit_id1 $head_id_truncated
40 c5f4d357 2023-04-22 thomas commit $head_id (master)
41 c5f4d357 2023-04-22 thomas from: Flan Hacker <flan_hacker@openbsd.org>
42 c5f4d357 2023-04-22 thomas date: $date
43 c5f4d357 2023-04-22 thomas
44 c5f4d357 2023-04-22 thomas changed alpha
45 c5f4d357 2023-04-22 thomas
46 c5f4d357 2023-04-22 thomas M alpha | 1+ 1-
47 c5f4d357 2023-04-22 thomas
48 c5f4d357 2023-04-22 thomas 1 file changed, 1 insertion(+), 1 deletion(-)
49 c5f4d357 2023-04-22 thomas
50 c5f4d357 2023-04-22 thomas commit - $commit_id1
51 c5f4d357 2023-04-22 thomas commit + $head_id
52 c5f4d357 2023-04-22 thomas blob - $alpha_id_old
53 c5f4d357 2023-04-22 thomas blob + $alpha_id
54 c5f4d357 2023-04-22 thomas --- alpha
55 c5f4d357 2023-04-22 thomas +++ alpha
56 c5f4d357 2023-04-22 thomas @@ -1 +1 @@
57 c5f4d357 2023-04-22 thomas -alpha
58 c5f4d357 2023-04-22 thomas +modified alpha
59 c5f4d357 2023-04-22 thomas
60 c5f4d357 2023-04-22 thomas
61 c5f4d357 2023-04-22 thomas
62 c5f4d357 2023-04-22 thomas (END)
63 c5f4d357 2023-04-22 thomas EOF
64 c5f4d357 2023-04-22 thomas
65 c5f4d357 2023-04-22 thomas cd $testroot/repo && tog diff $commit_id1 $head_id
66 c5f4d357 2023-04-22 thomas cmp -s $testroot/view.expected $testroot/view
67 c5f4d357 2023-04-22 thomas ret=$?
68 c5f4d357 2023-04-22 thomas if [ $ret -ne 0 ]; then
69 c5f4d357 2023-04-22 thomas diff -u $testroot/view.expected $testroot/view
70 c5f4d357 2023-04-22 thomas test_done "$testroot" "$ret"
71 c5f4d357 2023-04-22 thomas return 1
72 c5f4d357 2023-04-22 thomas fi
73 c5f4d357 2023-04-22 thomas
74 c5f4d357 2023-04-22 thomas test_done "$testroot" "$ret"
75 c5f4d357 2023-04-22 thomas }
76 c5f4d357 2023-04-22 thomas
77 c5f4d357 2023-04-22 thomas test_diff_arbitrary_commits()
78 c5f4d357 2023-04-22 thomas {
79 c5f4d357 2023-04-22 thomas test_init diff_arbitrary_commits 80 18
80 c5f4d357 2023-04-22 thomas
81 c5f4d357 2023-04-22 thomas local commit_id1=`git_show_head $testroot/repo`
82 c5f4d357 2023-04-22 thomas local alpha_id_old=`get_blob_id $testroot/repo "" alpha`
83 c5f4d357 2023-04-22 thomas
84 c5f4d357 2023-04-22 thomas echo "modified alpha" > $testroot/repo/alpha
85 c5f4d357 2023-04-22 thomas git_commit $testroot/repo -m "changed alpha"
86 c5f4d357 2023-04-22 thomas local commit_id2=`git_show_head $testroot/repo`
87 c5f4d357 2023-04-22 thomas
88 c5f4d357 2023-04-22 thomas echo "modified alpha again" > $testroot/repo/alpha
89 c5f4d357 2023-04-22 thomas echo "new file" > $testroot/repo/new
90 c5f4d357 2023-04-22 thomas (cd $testroot/repo && git add new)
91 c5f4d357 2023-04-22 thomas git_commit $testroot/repo -m "new file"
92 c5f4d357 2023-04-22 thomas local head_id=`git_show_head $testroot/repo`
93 c5f4d357 2023-04-22 thomas local head_id_truncated=`trim_obj_id 13 $head_id`
94 c5f4d357 2023-04-22 thomas local alpha_id=`get_blob_id $testroot/repo "" alpha`
95 c5f4d357 2023-04-22 thomas local new_id=`get_blob_id $testroot/repo "" new`
96 c5f4d357 2023-04-22 thomas
97 fa9bb690 2023-04-22 thomas cat <<EOF >$TOG_TEST_SCRIPT
98 c5f4d357 2023-04-22 thomas SCREENDUMP
99 c5f4d357 2023-04-22 thomas EOF
100 c5f4d357 2023-04-22 thomas
101 c5f4d357 2023-04-22 thomas cat <<EOF >$testroot/view.expected
102 c5f4d357 2023-04-22 thomas [1/16] diff $commit_id1 $head_id_truncated
103 c5f4d357 2023-04-22 thomas commit - $commit_id1
104 c5f4d357 2023-04-22 thomas commit + $head_id
105 c5f4d357 2023-04-22 thomas blob - $alpha_id_old
106 c5f4d357 2023-04-22 thomas blob + $alpha_id
107 c5f4d357 2023-04-22 thomas --- alpha
108 c5f4d357 2023-04-22 thomas +++ alpha
109 c5f4d357 2023-04-22 thomas @@ -1 +1 @@
110 c5f4d357 2023-04-22 thomas -alpha
111 c5f4d357 2023-04-22 thomas +modified alpha again
112 c5f4d357 2023-04-22 thomas blob - /dev/null
113 c5f4d357 2023-04-22 thomas blob + $new_id (mode 644)
114 c5f4d357 2023-04-22 thomas --- /dev/null
115 c5f4d357 2023-04-22 thomas +++ new
116 c5f4d357 2023-04-22 thomas @@ -0,0 +1 @@
117 c5f4d357 2023-04-22 thomas +new file
118 c5f4d357 2023-04-22 thomas
119 c5f4d357 2023-04-22 thomas (END)
120 c5f4d357 2023-04-22 thomas EOF
121 c5f4d357 2023-04-22 thomas
122 c5f4d357 2023-04-22 thomas cd $testroot/repo && tog diff $commit_id1 $head_id
123 c5f4d357 2023-04-22 thomas cmp -s $testroot/view.expected $testroot/view
124 c5f4d357 2023-04-22 thomas ret=$?
125 c5f4d357 2023-04-22 thomas if [ $ret -ne 0 ]; then
126 c5f4d357 2023-04-22 thomas diff -u $testroot/view.expected $testroot/view
127 c5f4d357 2023-04-22 thomas test_done "$testroot" "$ret"
128 c5f4d357 2023-04-22 thomas return 1
129 c5f4d357 2023-04-22 thomas fi
130 c5f4d357 2023-04-22 thomas
131 c5f4d357 2023-04-22 thomas test_done "$testroot" "$ret"
132 c5f4d357 2023-04-22 thomas }
133 c5f4d357 2023-04-22 thomas
134 52c5094b 2023-04-28 thomas test_diff_J_keymap_on_last_loaded_commit()
135 52c5094b 2023-04-28 thomas {
136 52c5094b 2023-04-28 thomas test_init diff_J_keymap_on_last_loaded_commit 94 24
137 52c5094b 2023-04-28 thomas
138 52c5094b 2023-04-28 thomas local i=0
139 52c5094b 2023-04-28 thomas
140 52c5094b 2023-04-28 thomas cd $testroot/repo
141 52c5094b 2023-04-28 thomas
142 52c5094b 2023-04-28 thomas while [ "$i" -lt 32 ]; do
143 52c5094b 2023-04-28 thomas echo $i > alpha
144 52c5094b 2023-04-28 thomas git commit -aqm $i
145 52c5094b 2023-04-28 thomas if [ $i -eq 6 ]; then
146 52c5094b 2023-04-28 thomas local id6=$(git_show_head .)
147 52c5094b 2023-04-28 thomas local blobid6=$(get_blob_id . "" alpha)
148 52c5094b 2023-04-28 thomas elif [ $i -eq 7 ]; then
149 52c5094b 2023-04-28 thomas local id7=$(git_show_head .)
150 52c5094b 2023-04-28 thomas local blobid7=$(get_blob_id . "" alpha)
151 52c5094b 2023-04-28 thomas local author_time=$(git_show_author_time .)
152 52c5094b 2023-04-28 thomas fi
153 52c5094b 2023-04-28 thomas i=$(( i + 1 ))
154 52c5094b 2023-04-28 thomas done
155 52c5094b 2023-04-28 thomas
156 52c5094b 2023-04-28 thomas local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
157 52c5094b 2023-04-28 thomas
158 52c5094b 2023-04-28 thomas cat <<EOF >$TOG_TEST_SCRIPT
159 52c5094b 2023-04-28 thomas KEY_ENTER open diff view of selected commit
160 52c5094b 2023-04-28 thomas S toggle horizontal split
161 52c5094b 2023-04-28 thomas TAB tab back to log view
162 52c5094b 2023-04-28 thomas 23j move to last loaded commit
163 52c5094b 2023-04-28 thomas KEY_ENTER select last loaded commit
164 52c5094b 2023-04-28 thomas F toggle fullscreen
165 52c5094b 2023-04-28 thomas J move down to next commit in the log
166 52c5094b 2023-04-28 thomas SCREENDUMP
167 52c5094b 2023-04-28 thomas EOF
168 52c5094b 2023-04-28 thomas
169 52c5094b 2023-04-28 thomas cat <<EOF >$testroot/view.expected
170 52c5094b 2023-04-28 thomas [1/20] diff $id6 $id7
171 52c5094b 2023-04-28 thomas commit $id7
172 52c5094b 2023-04-28 thomas from: Flan Hacker <flan_hacker@openbsd.org>
173 52c5094b 2023-04-28 thomas date: $date
174 52c5094b 2023-04-28 thomas
175 52c5094b 2023-04-28 thomas 7
176 52c5094b 2023-04-28 thomas
177 52c5094b 2023-04-28 thomas M alpha | 1+ 1-
178 52c5094b 2023-04-28 thomas
179 52c5094b 2023-04-28 thomas 1 file changed, 1 insertion(+), 1 deletion(-)
180 52c5094b 2023-04-28 thomas
181 52c5094b 2023-04-28 thomas commit - $id6
182 52c5094b 2023-04-28 thomas commit + $id7
183 52c5094b 2023-04-28 thomas blob - $blobid6
184 52c5094b 2023-04-28 thomas blob + $blobid7
185 52c5094b 2023-04-28 thomas --- alpha
186 52c5094b 2023-04-28 thomas +++ alpha
187 52c5094b 2023-04-28 thomas @@ -1 +1 @@
188 52c5094b 2023-04-28 thomas -6
189 52c5094b 2023-04-28 thomas +7
190 52c5094b 2023-04-28 thomas
191 52c5094b 2023-04-28 thomas
192 52c5094b 2023-04-28 thomas
193 52c5094b 2023-04-28 thomas (END)
194 52c5094b 2023-04-28 thomas EOF
195 52c5094b 2023-04-28 thomas
196 52c5094b 2023-04-28 thomas tog log
197 52c5094b 2023-04-28 thomas cmp -s $testroot/view.expected $testroot/view
198 52c5094b 2023-04-28 thomas ret=$?
199 52c5094b 2023-04-28 thomas if [ $ret -ne 0 ]; then
200 52c5094b 2023-04-28 thomas diff -u $testroot/view.expected $testroot/view
201 52c5094b 2023-04-28 thomas test_done "$testroot" "$ret"
202 52c5094b 2023-04-28 thomas return 1
203 52c5094b 2023-04-28 thomas fi
204 52c5094b 2023-04-28 thomas
205 52c5094b 2023-04-28 thomas test_done "$testroot" "$ret"
206 52c5094b 2023-04-28 thomas }
207 52c5094b 2023-04-28 thomas
208 66b04f8f 2023-07-19 thomas test_diff_commit_keywords()
209 66b04f8f 2023-07-19 thomas {
210 66b04f8f 2023-07-19 thomas test_init diff_commit_keywords 120 24
211 66b04f8f 2023-07-19 thomas local repo="$testroot/repo"
212 66b04f8f 2023-07-19 thomas local wt="$testroot/wt"
213 66b04f8f 2023-07-19 thomas local id=$(git_show_head "$repo")
214 66b04f8f 2023-07-19 thomas local author_time=$(git_show_author_time "$repo")
215 66b04f8f 2023-07-19 thomas
216 66b04f8f 2023-07-19 thomas set -A ids "$id"
217 66b04f8f 2023-07-19 thomas set -A alpha_ids $(get_blob_id "$repo" "" alpha)
218 f58fd006 2023-07-23 thomas set -A dates "$author_time"
219 66b04f8f 2023-07-19 thomas
220 66b04f8f 2023-07-19 thomas got checkout "$repo" "$wt" > /dev/null
221 66b04f8f 2023-07-19 thomas ret=$?
222 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
223 66b04f8f 2023-07-19 thomas echo "got checkout failed unexpectedly"
224 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
225 66b04f8f 2023-07-19 thomas return 1
226 66b04f8f 2023-07-19 thomas fi
227 66b04f8f 2023-07-19 thomas
228 66b04f8f 2023-07-19 thomas # move into the work tree (test is run in a subshell)
229 66b04f8f 2023-07-19 thomas cd "$wt"
230 66b04f8f 2023-07-19 thomas
231 66b04f8f 2023-07-19 thomas for i in $(seq 8); do
232 66b04f8f 2023-07-19 thomas echo "alpha $i" > alpha
233 66b04f8f 2023-07-19 thomas
234 66b04f8f 2023-07-19 thomas got ci -m "commit $i" > /dev/null
235 66b04f8f 2023-07-19 thomas ret=$?
236 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
237 66b04f8f 2023-07-19 thomas echo "commit failed unexpectedly" >&2
238 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
239 66b04f8f 2023-07-19 thomas return 1
240 66b04f8f 2023-07-19 thomas fi
241 66b04f8f 2023-07-19 thomas
242 66b04f8f 2023-07-19 thomas id=$(git_show_head "$repo")
243 66b04f8f 2023-07-19 thomas set -- "$ids" "$id"
244 66b04f8f 2023-07-19 thomas ids=$*
245 66b04f8f 2023-07-19 thomas set -- "$alpha_ids" "$(get_blob_id "$repo" "" alpha)"
246 66b04f8f 2023-07-19 thomas alpha_ids=$*
247 f58fd006 2023-07-23 thomas set -- "$dates" $(git_show_author_time "$repo")
248 f58fd006 2023-07-23 thomas dates=$*
249 66b04f8f 2023-07-19 thomas done
250 66b04f8f 2023-07-19 thomas
251 66b04f8f 2023-07-19 thomas cat <<-EOF >$TOG_TEST_SCRIPT
252 66b04f8f 2023-07-19 thomas SCREENDUMP
253 66b04f8f 2023-07-19 thomas EOF
254 66b04f8f 2023-07-19 thomas
255 66b04f8f 2023-07-19 thomas # diff consecutive commits with keywords
256 66b04f8f 2023-07-19 thomas local lhs_id=$(pop_id 1 $ids)
257 66b04f8f 2023-07-19 thomas local rhs_id=$(pop_id 2 $ids)
258 f58fd006 2023-07-23 thomas local date=$(date -u -r $(pop_id 2 $dates) +"%a %b %e %X %Y UTC")
259 66b04f8f 2023-07-19 thomas
260 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
261 66b04f8f 2023-07-19 thomas [1/20] diff $lhs_id $rhs_id
262 66b04f8f 2023-07-19 thomas commit $rhs_id
263 66b04f8f 2023-07-19 thomas from: Flan Hacker <flan_hacker@openbsd.org>
264 66b04f8f 2023-07-19 thomas date: $date
265 66b04f8f 2023-07-19 thomas
266 66b04f8f 2023-07-19 thomas commit 1
267 66b04f8f 2023-07-19 thomas
268 66b04f8f 2023-07-19 thomas M alpha | 1+ 1-
269 66b04f8f 2023-07-19 thomas
270 66b04f8f 2023-07-19 thomas 1 file changed, 1 insertion(+), 1 deletion(-)
271 66b04f8f 2023-07-19 thomas
272 66b04f8f 2023-07-19 thomas commit - $lhs_id
273 66b04f8f 2023-07-19 thomas commit + $rhs_id
274 66b04f8f 2023-07-19 thomas blob - $(pop_id 1 $alpha_ids)
275 66b04f8f 2023-07-19 thomas blob + $(pop_id 2 $alpha_ids)
276 66b04f8f 2023-07-19 thomas --- alpha
277 66b04f8f 2023-07-19 thomas +++ alpha
278 66b04f8f 2023-07-19 thomas @@ -1 +1 @@
279 66b04f8f 2023-07-19 thomas -alpha
280 66b04f8f 2023-07-19 thomas +alpha 1
281 66b04f8f 2023-07-19 thomas
282 66b04f8f 2023-07-19 thomas
283 66b04f8f 2023-07-19 thomas
284 66b04f8f 2023-07-19 thomas (END)
285 66b04f8f 2023-07-19 thomas EOF
286 66b04f8f 2023-07-19 thomas
287 66b04f8f 2023-07-19 thomas tog diff :base:-99 :head:-7
288 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
289 66b04f8f 2023-07-19 thomas ret=$?
290 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
291 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
292 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
293 66b04f8f 2023-07-19 thomas return 1
294 66b04f8f 2023-07-19 thomas fi
295 66b04f8f 2023-07-19 thomas
296 66b04f8f 2023-07-19 thomas # diff arbitrary commits with keywords
297 66b04f8f 2023-07-19 thomas lhs_id=$(pop_id 5 $ids)
298 66b04f8f 2023-07-19 thomas rhs_id=$(pop_id 8 $ids)
299 66b04f8f 2023-07-19 thomas
300 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
301 66b04f8f 2023-07-19 thomas [1/10] diff $lhs_id $rhs_id
302 66b04f8f 2023-07-19 thomas commit - $lhs_id
303 66b04f8f 2023-07-19 thomas commit + $rhs_id
304 66b04f8f 2023-07-19 thomas blob - $(pop_id 5 $alpha_ids)
305 66b04f8f 2023-07-19 thomas blob + $(pop_id 8 $alpha_ids)
306 66b04f8f 2023-07-19 thomas --- alpha
307 66b04f8f 2023-07-19 thomas +++ alpha
308 66b04f8f 2023-07-19 thomas @@ -1 +1 @@
309 66b04f8f 2023-07-19 thomas -alpha 4
310 66b04f8f 2023-07-19 thomas +alpha 7
311 66b04f8f 2023-07-19 thomas
312 66b04f8f 2023-07-19 thomas
313 66b04f8f 2023-07-19 thomas
314 66b04f8f 2023-07-19 thomas
315 66b04f8f 2023-07-19 thomas
316 66b04f8f 2023-07-19 thomas
317 66b04f8f 2023-07-19 thomas
318 66b04f8f 2023-07-19 thomas
319 66b04f8f 2023-07-19 thomas
320 66b04f8f 2023-07-19 thomas
321 66b04f8f 2023-07-19 thomas
322 66b04f8f 2023-07-19 thomas
323 66b04f8f 2023-07-19 thomas
324 66b04f8f 2023-07-19 thomas (END)
325 66b04f8f 2023-07-19 thomas EOF
326 66b04f8f 2023-07-19 thomas
327 66b04f8f 2023-07-19 thomas tog diff master:-4 :head:-
328 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
329 66b04f8f 2023-07-19 thomas ret=$?
330 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
331 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
332 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
333 66b04f8f 2023-07-19 thomas return 1
334 66b04f8f 2023-07-19 thomas fi
335 66b04f8f 2023-07-19 thomas
336 66b04f8f 2023-07-19 thomas # diff consecutive commits using keywords with -r repository
337 66b04f8f 2023-07-19 thomas lhs_id=$(pop_id 8 $ids)
338 66b04f8f 2023-07-19 thomas rhs_id=$(pop_id 9 $ids)
339 f58fd006 2023-07-23 thomas date=$(date -u -r $(pop_id 9 $dates) +"%a %b %e %X %Y UTC")
340 66b04f8f 2023-07-19 thomas
341 66b04f8f 2023-07-19 thomas cat <<-EOF >$testroot/view.expected
342 66b04f8f 2023-07-19 thomas [1/20] diff $lhs_id refs/heads/master
343 66b04f8f 2023-07-19 thomas commit $rhs_id (master)
344 66b04f8f 2023-07-19 thomas from: Flan Hacker <flan_hacker@openbsd.org>
345 66b04f8f 2023-07-19 thomas date: $date
346 66b04f8f 2023-07-19 thomas
347 66b04f8f 2023-07-19 thomas commit 8
348 66b04f8f 2023-07-19 thomas
349 66b04f8f 2023-07-19 thomas M alpha | 1+ 1-
350 66b04f8f 2023-07-19 thomas
351 66b04f8f 2023-07-19 thomas 1 file changed, 1 insertion(+), 1 deletion(-)
352 66b04f8f 2023-07-19 thomas
353 66b04f8f 2023-07-19 thomas commit - $lhs_id
354 66b04f8f 2023-07-19 thomas commit + $rhs_id
355 66b04f8f 2023-07-19 thomas blob - $(pop_id 8 $alpha_ids)
356 66b04f8f 2023-07-19 thomas blob + $(pop_id 9 $alpha_ids)
357 66b04f8f 2023-07-19 thomas --- alpha
358 66b04f8f 2023-07-19 thomas +++ alpha
359 66b04f8f 2023-07-19 thomas @@ -1 +1 @@
360 66b04f8f 2023-07-19 thomas -alpha 7
361 66b04f8f 2023-07-19 thomas +alpha 8
362 66b04f8f 2023-07-19 thomas
363 66b04f8f 2023-07-19 thomas
364 66b04f8f 2023-07-19 thomas
365 66b04f8f 2023-07-19 thomas (END)
366 66b04f8f 2023-07-19 thomas EOF
367 66b04f8f 2023-07-19 thomas
368 66b04f8f 2023-07-19 thomas tog diff -r "$repo" :head:- master
369 66b04f8f 2023-07-19 thomas cmp -s "$testroot/view.expected" "$testroot/view"
370 66b04f8f 2023-07-19 thomas ret=$?
371 66b04f8f 2023-07-19 thomas if [ $ret -ne 0 ]; then
372 66b04f8f 2023-07-19 thomas diff -u "$testroot/view.expected" "$testroot/view"
373 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
374 66b04f8f 2023-07-19 thomas return 1
375 66b04f8f 2023-07-19 thomas fi
376 66b04f8f 2023-07-19 thomas
377 66b04f8f 2023-07-19 thomas test_done "$testroot" "$ret"
378 66b04f8f 2023-07-19 thomas }
379 66b04f8f 2023-07-19 thomas
380 c5f4d357 2023-04-22 thomas test_parseargs "$@"
381 c5f4d357 2023-04-22 thomas run_test test_diff_contiguous_commits
382 c5f4d357 2023-04-22 thomas run_test test_diff_arbitrary_commits
383 52c5094b 2023-04-28 thomas run_test test_diff_J_keymap_on_last_loaded_commit
384 66b04f8f 2023-07-19 thomas run_test test_diff_commit_keywords