3 0ebf8283 2019-07-24 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 0ebf8283 2019-07-24 stsp # Permission to use, copy, modify, and distribute this software for any
6 0ebf8283 2019-07-24 stsp # purpose with or without fee is hereby granted, provided that the above
7 0ebf8283 2019-07-24 stsp # copyright notice and this permission notice appear in all copies.
9 0ebf8283 2019-07-24 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 0ebf8283 2019-07-24 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 0ebf8283 2019-07-24 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 0ebf8283 2019-07-24 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 0ebf8283 2019-07-24 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 0ebf8283 2019-07-24 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 0ebf8283 2019-07-24 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 0ebf8283 2019-07-24 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_histedit_no_op() {
20 0ebf8283 2019-07-24 stsp local testroot=`test_init histedit_no_op`
22 0ebf8283 2019-07-24 stsp local orig_commit=`git_show_head $testroot/repo`
23 e600f124 2021-03-21 stsp local orig_author_time=`git_show_author_time $testroot/repo`
25 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
26 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git rm -q beta)
27 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/repo/epsilon/new
28 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git add epsilon/new)
29 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing changes"
30 0ebf8283 2019-07-24 stsp local old_commit1=`git_show_head $testroot/repo`
31 ad324bf5 2021-09-21 stsp local old_author_time1=`git_show_author_time $testroot/repo`
33 0ebf8283 2019-07-24 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
34 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing to zeta on master"
35 0ebf8283 2019-07-24 stsp local old_commit2=`git_show_head $testroot/repo`
36 e600f124 2021-03-21 stsp local old_author_time2=`git_show_author_time $testroot/repo`
38 86ac67ee 2019-07-25 stsp got diff -r $testroot/repo $orig_commit $old_commit2 \
39 86ac67ee 2019-07-25 stsp > $testroot/diff.expected
41 0ebf8283 2019-07-24 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
43 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
44 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
48 0ebf8283 2019-07-24 stsp echo "pick $old_commit1" > $testroot/histedit-script
49 0ebf8283 2019-07-24 stsp echo "pick $old_commit2" >> $testroot/histedit-script
51 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
52 0ebf8283 2019-07-24 stsp > $testroot/stdout)
54 0ebf8283 2019-07-24 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
55 0ebf8283 2019-07-24 stsp local new_commit2=`git_show_head $testroot/repo`
56 e600f124 2021-03-21 stsp local new_author_time2=`git_show_author_time $testroot/repo`
58 0ebf8283 2019-07-24 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
59 0ebf8283 2019-07-24 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
60 0ebf8283 2019-07-24 stsp local short_new_commit1=`trim_obj_id 28 $new_commit1`
61 0ebf8283 2019-07-24 stsp local short_new_commit2=`trim_obj_id 28 $new_commit2`
63 0ebf8283 2019-07-24 stsp echo "G alpha" > $testroot/stdout.expected
64 0ebf8283 2019-07-24 stsp echo "D beta" >> $testroot/stdout.expected
65 0ebf8283 2019-07-24 stsp echo "A epsilon/new" >> $testroot/stdout.expected
66 0ebf8283 2019-07-24 stsp echo "$short_old_commit1 -> $short_new_commit1: committing changes" \
67 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
68 0ebf8283 2019-07-24 stsp echo "G epsilon/zeta" >> $testroot/stdout.expected
69 0ebf8283 2019-07-24 stsp echo -n "$short_old_commit2 -> $short_new_commit2: " \
70 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
71 0ebf8283 2019-07-24 stsp echo "committing to zeta on master" >> $testroot/stdout.expected
72 0ebf8283 2019-07-24 stsp echo "Switching work tree to refs/heads/master" \
73 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
75 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
77 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
78 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
79 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
83 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/content.expected
84 0ebf8283 2019-07-24 stsp cat $testroot/wt/alpha > $testroot/content
85 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
87 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
88 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
89 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
93 0ebf8283 2019-07-24 stsp if [ -e $testroot/wt/beta ]; then
94 0ebf8283 2019-07-24 stsp echo "removed file beta still exists on disk" >&2
95 0ebf8283 2019-07-24 stsp test_done "$testroot" "1"
99 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/content.expected
100 0ebf8283 2019-07-24 stsp cat $testroot/wt/epsilon/new > $testroot/content
101 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
103 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
104 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
105 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
109 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
111 0ebf8283 2019-07-24 stsp echo -n > $testroot/stdout.expected
112 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
114 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
115 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
116 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
120 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
121 0ebf8283 2019-07-24 stsp echo "commit $new_commit2 (master)" > $testroot/stdout.expected
122 0ebf8283 2019-07-24 stsp echo "commit $new_commit1" >> $testroot/stdout.expected
123 0ebf8283 2019-07-24 stsp echo "commit $orig_commit" >> $testroot/stdout.expected
124 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
126 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
127 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
128 86ac67ee 2019-07-25 stsp test_done "$testroot" "$ret"
132 86ac67ee 2019-07-25 stsp got diff -r $testroot/repo $orig_commit $new_commit2 \
133 86ac67ee 2019-07-25 stsp > $testroot/diff
134 fa37079f 2021-10-09 thomas sed -i '' -e "s/$old_commit2/$new_commit2/" $testroot/diff.expected
135 86ac67ee 2019-07-25 stsp cmp -s $testroot/diff.expected $testroot/diff
137 86ac67ee 2019-07-25 stsp if [ "$ret" != "0" ]; then
138 86ac67ee 2019-07-25 stsp diff -u $testroot/diff.expected $testroot/diff
139 a615e0e7 2020-12-16 stsp test_done "$testroot" "$ret"
143 a615e0e7 2020-12-16 stsp (cd $testroot/wt && got update > $testroot/stdout)
145 a615e0e7 2020-12-16 stsp echo 'Already up-to-date' > $testroot/stdout.expected
146 e600f124 2021-03-21 stsp cmp -s $testroot/stdout.expected $testroot/stdout
148 e600f124 2021-03-21 stsp if [ "$ret" != "0" ]; then
149 e600f124 2021-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
150 e600f124 2021-03-21 stsp test_done "$testroot" "$ret"
154 e600f124 2021-03-21 stsp # We should have a backup of old commits
155 e600f124 2021-03-21 stsp (cd $testroot/repo && got histedit -l > $testroot/stdout)
156 180f111d 2021-09-21 thomas.ad d_orig1=`date -u -d "@$old_author_time1" +"%G-%m-%d"`
158 fa37079f 2021-10-09 thomas local prev_LC_TIME="$LC_TIME"
159 fa37079f 2021-10-09 thomas export LC_TIME=C
160 fa37079f 2021-10-09 thomas d_orig2=`date -u -d "@$old_author_time2" +"%a %b %e %X %Y UTC"`
161 fa37079f 2021-10-09 thomas export LC_TIME="$prev_LC_TIME"
162 180f111d 2021-09-21 thomas.ad d_new2=`date -u -d "@$new_author_time2" +"%G-%m-%d"`
163 180f111d 2021-09-21 thomas.ad d_orig=`date -u -d "@$orig_author_time" +"%G-%m-%d"`
164 e600f124 2021-03-21 stsp cat > $testroot/stdout.expected <<EOF
165 e600f124 2021-03-21 stsp -----------------------------------------------
166 e600f124 2021-03-21 stsp commit $old_commit2 (formerly master)
167 e600f124 2021-03-21 stsp from: $GOT_AUTHOR
168 e600f124 2021-03-21 stsp date: $d_orig2
170 e600f124 2021-03-21 stsp committing to zeta on master
172 e600f124 2021-03-21 stsp has become commit $new_commit2 (master)
173 e600f124 2021-03-21 stsp $d_new2 $GOT_AUTHOR_11 committing to zeta on master
176 ad324bf5 2021-09-21 stsp local is_forked=true d_fork fork_commit fork_commit_msg
178 ad324bf5 2021-09-21 stsp if [ "$old_commit1" = "$new_commit1" ]; then
179 ad324bf5 2021-09-21 stsp if [ "$old_commit2" = "$new_commit2" ]; then
180 ad324bf5 2021-09-21 stsp is_forked=false
182 ad324bf5 2021-09-21 stsp d_fork=$d_orig1
183 ad324bf5 2021-09-21 stsp fork_commit=$new_commit1
184 ad324bf5 2021-09-21 stsp fork_commit_msg="committing changes"
187 ad324bf5 2021-09-21 stsp d_fork=$d_orig
188 ad324bf5 2021-09-21 stsp fork_commit=$orig_commit
189 ad324bf5 2021-09-21 stsp fork_commit_msg="adding the test tree"
192 ad324bf5 2021-09-21 stsp $is_forked && cat >> $testroot/stdout.expected <<EOF
193 ad324bf5 2021-09-21 stsp history forked at $fork_commit
194 ad324bf5 2021-09-21 stsp $d_fork $GOT_AUTHOR_11 $fork_commit_msg
197 a615e0e7 2020-12-16 stsp cmp -s $testroot/stdout.expected $testroot/stdout
199 a615e0e7 2020-12-16 stsp if [ "$ret" != "0" ]; then
200 a615e0e7 2020-12-16 stsp diff -u $testroot/stdout.expected $testroot/stdout
201 643b85bc 2021-07-16 stsp test_done "$testroot" "$ret"
205 643b85bc 2021-07-16 stsp (cd $testroot/repo && got histedit -X master \
206 643b85bc 2021-07-16 stsp > $testroot/stdout 2> $testroot/stderr)
207 643b85bc 2021-07-16 stsp echo -n "Deleted refs/got/backup/histedit/master/$new_commit2: " \
208 643b85bc 2021-07-16 stsp > $testroot/stdout.expected
209 643b85bc 2021-07-16 stsp echo "$old_commit2" >> $testroot/stdout.expected
210 643b85bc 2021-07-16 stsp echo -n > $testroot/stderr.expected
211 643b85bc 2021-07-16 stsp cmp -s $testroot/stdout.expected $testroot/stdout
213 643b85bc 2021-07-16 stsp if [ "$ret" != "0" ]; then
214 643b85bc 2021-07-16 stsp diff -u $testroot/stdout.expected $testroot/stdout
215 643b85bc 2021-07-16 stsp test_done "$testroot" "$ret"
218 643b85bc 2021-07-16 stsp cmp -s $testroot/stderr.expected $testroot/stderr
220 643b85bc 2021-07-16 stsp if [ "$ret" != "0" ]; then
221 643b85bc 2021-07-16 stsp diff -u $testroot/stderr.expected $testroot/stderr
222 643b85bc 2021-07-16 stsp test_done "$testroot" "$ret"
226 643b85bc 2021-07-16 stsp (cd $testroot/repo && got histedit -l > $testroot/stdout)
227 643b85bc 2021-07-16 stsp echo -n > $testroot/stdout.expected
228 643b85bc 2021-07-16 stsp cmp -s $testroot/stdout.expected $testroot/stdout
230 643b85bc 2021-07-16 stsp if [ "$ret" != "0" ]; then
231 643b85bc 2021-07-16 stsp diff -u $testroot/stdout.expected $testroot/stdout
233 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
236 f6cae3ed 2020-09-13 naddy test_histedit_swap() {
237 0ebf8283 2019-07-24 stsp local testroot=`test_init histedit_swap`
239 0ebf8283 2019-07-24 stsp local orig_commit=`git_show_head $testroot/repo`
241 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
242 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git rm -q beta)
243 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/repo/epsilon/new
244 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git add epsilon/new)
245 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing changes"
246 0ebf8283 2019-07-24 stsp local old_commit1=`git_show_head $testroot/repo`
248 0ebf8283 2019-07-24 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
249 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing to zeta on master"
250 0ebf8283 2019-07-24 stsp local old_commit2=`git_show_head $testroot/repo`
252 86ac67ee 2019-07-25 stsp got diff -r $testroot/repo $orig_commit $old_commit2 \
253 86ac67ee 2019-07-25 stsp > $testroot/diff.expected
255 0ebf8283 2019-07-24 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
257 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
258 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
262 0ebf8283 2019-07-24 stsp echo "pick $old_commit2" > $testroot/histedit-script
263 0ebf8283 2019-07-24 stsp echo "pick $old_commit1" >> $testroot/histedit-script
265 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
266 0ebf8283 2019-07-24 stsp > $testroot/stdout)
268 0ebf8283 2019-07-24 stsp local new_commit2=`git_show_parent_commit $testroot/repo`
269 0ebf8283 2019-07-24 stsp local new_commit1=`git_show_head $testroot/repo`
271 0ebf8283 2019-07-24 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
272 0ebf8283 2019-07-24 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
273 0ebf8283 2019-07-24 stsp local short_new_commit1=`trim_obj_id 28 $new_commit1`
274 0ebf8283 2019-07-24 stsp local short_new_commit2=`trim_obj_id 28 $new_commit2`
276 0ebf8283 2019-07-24 stsp echo "G epsilon/zeta" > $testroot/stdout.expected
277 0ebf8283 2019-07-24 stsp echo -n "$short_old_commit2 -> $short_new_commit2: " \
278 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
279 0ebf8283 2019-07-24 stsp echo "committing to zeta on master" >> $testroot/stdout.expected
280 0ebf8283 2019-07-24 stsp echo "G alpha" >> $testroot/stdout.expected
281 0ebf8283 2019-07-24 stsp echo "D beta" >> $testroot/stdout.expected
282 0ebf8283 2019-07-24 stsp echo "A epsilon/new" >> $testroot/stdout.expected
283 0ebf8283 2019-07-24 stsp echo "$short_old_commit1 -> $short_new_commit1: committing changes" \
284 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
285 0ebf8283 2019-07-24 stsp echo "Switching work tree to refs/heads/master" \
286 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
288 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
290 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
291 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
292 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
296 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/content.expected
297 0ebf8283 2019-07-24 stsp cat $testroot/wt/alpha > $testroot/content
298 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
300 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
301 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
302 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
306 0ebf8283 2019-07-24 stsp if [ -e $testroot/wt/beta ]; then
307 0ebf8283 2019-07-24 stsp echo "removed file beta still exists on disk" >&2
308 0ebf8283 2019-07-24 stsp test_done "$testroot" "1"
312 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/content.expected
313 0ebf8283 2019-07-24 stsp cat $testroot/wt/epsilon/new > $testroot/content
314 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
316 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
317 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
318 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
322 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
324 0ebf8283 2019-07-24 stsp echo -n > $testroot/stdout.expected
325 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
327 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
328 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
329 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
333 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
334 0ebf8283 2019-07-24 stsp echo "commit $new_commit1 (master)" > $testroot/stdout.expected
335 0ebf8283 2019-07-24 stsp echo "commit $new_commit2" >> $testroot/stdout.expected
336 0ebf8283 2019-07-24 stsp echo "commit $orig_commit" >> $testroot/stdout.expected
337 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
339 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
340 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
341 86ac67ee 2019-07-25 stsp test_done "$testroot" "$ret"
345 86ac67ee 2019-07-25 stsp got diff -r $testroot/repo $orig_commit $new_commit1 \
346 86ac67ee 2019-07-25 stsp > $testroot/diff
347 fa37079f 2021-10-09 thomas sed -i '' -e "s/$old_commit2/$new_commit1/" $testroot/diff.expected
348 86ac67ee 2019-07-25 stsp cmp -s $testroot/diff.expected $testroot/diff
350 86ac67ee 2019-07-25 stsp if [ "$ret" != "0" ]; then
351 86ac67ee 2019-07-25 stsp diff -u $testroot/diff.expected $testroot/diff
353 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
356 f6cae3ed 2020-09-13 naddy test_histedit_drop() {
357 0ebf8283 2019-07-24 stsp local testroot=`test_init histedit_drop`
358 0ebf8283 2019-07-24 stsp local orig_commit=`git_show_head $testroot/repo`
360 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
361 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git rm -q beta)
362 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/repo/epsilon/new
363 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git add epsilon/new)
364 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing changes"
365 0ebf8283 2019-07-24 stsp local old_commit1=`git_show_head $testroot/repo`
367 0ebf8283 2019-07-24 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
368 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing to zeta on master"
369 0ebf8283 2019-07-24 stsp local old_commit2=`git_show_head $testroot/repo`
371 86ac67ee 2019-07-25 stsp got diff -r $testroot/repo $old_commit1 $old_commit2 \
372 86ac67ee 2019-07-25 stsp > $testroot/diff.expected
374 0ebf8283 2019-07-24 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
376 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
377 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
381 0ebf8283 2019-07-24 stsp echo "drop $old_commit1" > $testroot/histedit-script
382 0ebf8283 2019-07-24 stsp echo "pick $old_commit2" >> $testroot/histedit-script
384 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
385 0ebf8283 2019-07-24 stsp > $testroot/stdout)
387 0ebf8283 2019-07-24 stsp local new_commit2=`git_show_head $testroot/repo`
389 0ebf8283 2019-07-24 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
390 0ebf8283 2019-07-24 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
391 0ebf8283 2019-07-24 stsp local short_new_commit2=`trim_obj_id 28 $new_commit2`
393 0ebf8283 2019-07-24 stsp echo "$short_old_commit1 -> drop commit: committing changes" \
394 0ebf8283 2019-07-24 stsp > $testroot/stdout.expected
395 0ebf8283 2019-07-24 stsp echo "G epsilon/zeta" >> $testroot/stdout.expected
396 0ebf8283 2019-07-24 stsp echo -n "$short_old_commit2 -> $short_new_commit2: " \
397 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
398 0ebf8283 2019-07-24 stsp echo "committing to zeta on master" >> $testroot/stdout.expected
399 0ebf8283 2019-07-24 stsp echo "Switching work tree to refs/heads/master" \
400 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
402 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
404 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
405 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
406 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
410 0ebf8283 2019-07-24 stsp for f in alpha beta; do
411 0ebf8283 2019-07-24 stsp echo "$f" > $testroot/content.expected
412 0ebf8283 2019-07-24 stsp cat $testroot/wt/$f > $testroot/content
413 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
415 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
416 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
417 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
422 0ebf8283 2019-07-24 stsp if [ -e $testroot/wt/new ]; then
423 0ebf8283 2019-07-24 stsp echo "file new exists on disk but should not" >&2
424 0ebf8283 2019-07-24 stsp test_done "$testroot" "1"
428 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
430 0ebf8283 2019-07-24 stsp echo -n > $testroot/stdout.expected
431 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
433 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
434 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
435 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
439 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
440 0ebf8283 2019-07-24 stsp echo "commit $new_commit2 (master)" > $testroot/stdout.expected
441 0ebf8283 2019-07-24 stsp echo "commit $orig_commit" >> $testroot/stdout.expected
442 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
444 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
445 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
446 86ac67ee 2019-07-25 stsp test_done "$testroot" "$ret"
450 86ac67ee 2019-07-25 stsp got diff -r $testroot/repo $orig_commit $new_commit2 \
451 86ac67ee 2019-07-25 stsp > $testroot/diff
452 fa37079f 2021-10-09 thomas sed -i '' -e "s/$old_commit1/$orig_commit/" $testroot/diff.expected
453 fa37079f 2021-10-09 thomas sed -i '' -e "s/$old_commit2/$new_commit2/" $testroot/diff.expected
454 86ac67ee 2019-07-25 stsp cmp -s $testroot/diff.expected $testroot/diff
456 86ac67ee 2019-07-25 stsp if [ "$ret" != "0" ]; then
457 86ac67ee 2019-07-25 stsp diff -u $testroot/diff.expected $testroot/diff
459 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
462 f6cae3ed 2020-09-13 naddy test_histedit_fold() {
463 0ebf8283 2019-07-24 stsp local testroot=`test_init histedit_fold`
465 0ebf8283 2019-07-24 stsp local orig_commit=`git_show_head $testroot/repo`
467 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
468 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git rm -q beta)
469 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/repo/epsilon/new
470 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git add epsilon/new)
471 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing changes"
472 0ebf8283 2019-07-24 stsp local old_commit1=`git_show_head $testroot/repo`
474 0ebf8283 2019-07-24 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
475 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing to zeta on master"
476 0ebf8283 2019-07-24 stsp local old_commit2=`git_show_head $testroot/repo`
478 3f9de99f 2019-07-24 stsp echo "modified delta on master" > $testroot/repo/gamma/delta
479 3f9de99f 2019-07-24 stsp git_commit $testroot/repo -m "committing to delta on master"
480 3f9de99f 2019-07-24 stsp local old_commit3=`git_show_head $testroot/repo`
482 0ebf8283 2019-07-24 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
484 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
485 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
489 0ebf8283 2019-07-24 stsp echo "fold $old_commit1" > $testroot/histedit-script
490 3f9de99f 2019-07-24 stsp echo "drop $old_commit2" >> $testroot/histedit-script
491 3f9de99f 2019-07-24 stsp echo "pick $old_commit3" >> $testroot/histedit-script
492 0ebf8283 2019-07-24 stsp echo "mesg committing folded changes" >> $testroot/histedit-script
494 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
495 0ebf8283 2019-07-24 stsp > $testroot/stdout)
497 0ebf8283 2019-07-24 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
498 0ebf8283 2019-07-24 stsp local new_commit2=`git_show_head $testroot/repo`
500 0ebf8283 2019-07-24 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
501 0ebf8283 2019-07-24 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
502 3f9de99f 2019-07-24 stsp local short_old_commit3=`trim_obj_id 28 $old_commit3`
503 0ebf8283 2019-07-24 stsp local short_new_commit1=`trim_obj_id 28 $new_commit1`
504 0ebf8283 2019-07-24 stsp local short_new_commit2=`trim_obj_id 28 $new_commit2`
506 0ebf8283 2019-07-24 stsp echo "G alpha" > $testroot/stdout.expected
507 0ebf8283 2019-07-24 stsp echo "D beta" >> $testroot/stdout.expected
508 0ebf8283 2019-07-24 stsp echo "A epsilon/new" >> $testroot/stdout.expected
509 0ebf8283 2019-07-24 stsp echo "$short_old_commit1 -> fold commit: committing changes" \
510 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
511 3f9de99f 2019-07-24 stsp echo -n "$short_old_commit2 -> " >> $testroot/stdout.expected
512 3f9de99f 2019-07-24 stsp echo "drop commit: committing to zeta on master" \
513 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
514 3f9de99f 2019-07-24 stsp echo "G gamma/delta" >> $testroot/stdout.expected
515 3f9de99f 2019-07-24 stsp echo -n "$short_old_commit3 -> $short_new_commit2: " \
516 3f9de99f 2019-07-24 stsp >> $testroot/stdout.expected
517 0ebf8283 2019-07-24 stsp echo "committing folded changes" >> $testroot/stdout.expected
518 0ebf8283 2019-07-24 stsp echo "Switching work tree to refs/heads/master" \
519 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
521 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
523 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
524 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
525 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
529 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/content.expected
530 0ebf8283 2019-07-24 stsp cat $testroot/wt/alpha > $testroot/content
531 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
533 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
534 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
535 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
539 0ebf8283 2019-07-24 stsp if [ -e $testroot/wt/beta ]; then
540 0ebf8283 2019-07-24 stsp echo "removed file beta still exists on disk" >&2
541 0ebf8283 2019-07-24 stsp test_done "$testroot" "1"
545 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/content.expected
546 0ebf8283 2019-07-24 stsp cat $testroot/wt/epsilon/new > $testroot/content
547 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
549 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
550 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
551 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
555 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
557 0ebf8283 2019-07-24 stsp echo -n > $testroot/stdout.expected
558 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
560 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
561 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
562 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
566 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
567 0ebf8283 2019-07-24 stsp echo "commit $new_commit2 (master)" > $testroot/stdout.expected
568 0ebf8283 2019-07-24 stsp echo "commit $orig_commit" >> $testroot/stdout.expected
569 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
571 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
572 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
574 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
577 f6cae3ed 2020-09-13 naddy test_histedit_edit() {
578 0ebf8283 2019-07-24 stsp local testroot=`test_init histedit_edit`
580 0ebf8283 2019-07-24 stsp local orig_commit=`git_show_head $testroot/repo`
582 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
583 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git rm -q beta)
584 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/repo/epsilon/new
585 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git add epsilon/new)
586 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing changes"
587 0ebf8283 2019-07-24 stsp local old_commit1=`git_show_head $testroot/repo`
589 0ebf8283 2019-07-24 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
590 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing to zeta on master"
591 0ebf8283 2019-07-24 stsp local old_commit2=`git_show_head $testroot/repo`
593 0ebf8283 2019-07-24 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
595 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
596 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
600 0ebf8283 2019-07-24 stsp echo "edit $old_commit1" > $testroot/histedit-script
601 0ebf8283 2019-07-24 stsp echo "mesg committing changes" >> $testroot/histedit-script
602 0ebf8283 2019-07-24 stsp echo "pick $old_commit2" >> $testroot/histedit-script
604 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
605 0ebf8283 2019-07-24 stsp > $testroot/stdout)
607 0ebf8283 2019-07-24 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
608 0ebf8283 2019-07-24 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
610 0ebf8283 2019-07-24 stsp echo "G alpha" > $testroot/stdout.expected
611 0ebf8283 2019-07-24 stsp echo "D beta" >> $testroot/stdout.expected
612 0ebf8283 2019-07-24 stsp echo "A epsilon/new" >> $testroot/stdout.expected
613 0ebf8283 2019-07-24 stsp echo "Stopping histedit for amending commit $old_commit1" \
614 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
615 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
617 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
618 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
619 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
623 0ebf8283 2019-07-24 stsp echo "edited modified alpha on master" > $testroot/wt/alpha
625 f032f1f7 2019-08-04 stsp # test interaction of 'got stage' and histedit -c
626 f032f1f7 2019-08-04 stsp (cd $testroot/wt && got stage alpha > /dev/null)
627 f032f1f7 2019-08-04 stsp (cd $testroot/wt && got histedit -c > $testroot/stdout \
628 f032f1f7 2019-08-04 stsp 2> $testroot/stderr)
630 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
631 f032f1f7 2019-08-04 stsp echo "histedit succeeded unexpectedly" >&2
632 f032f1f7 2019-08-04 stsp test_done "$testroot" "1"
635 f032f1f7 2019-08-04 stsp echo -n "got: work tree contains files with staged changes; " \
636 f032f1f7 2019-08-04 stsp > $testroot/stderr.expected
637 f032f1f7 2019-08-04 stsp echo "these changes must be committed or unstaged first" \
638 f032f1f7 2019-08-04 stsp >> $testroot/stderr.expected
639 f032f1f7 2019-08-04 stsp cmp -s $testroot/stderr.expected $testroot/stderr
641 f032f1f7 2019-08-04 stsp if [ "$ret" != "0" ]; then
642 f032f1f7 2019-08-04 stsp diff -u $testroot/stderr.expected $testroot/stderr
643 f032f1f7 2019-08-04 stsp test_done "$testroot" "$ret"
647 f032f1f7 2019-08-04 stsp (cd $testroot/wt && got unstage alpha > /dev/null)
648 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -c > $testroot/stdout)
650 0ebf8283 2019-07-24 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
651 0ebf8283 2019-07-24 stsp local new_commit2=`git_show_head $testroot/repo`
653 0ebf8283 2019-07-24 stsp local short_new_commit1=`trim_obj_id 28 $new_commit1`
654 0ebf8283 2019-07-24 stsp local short_new_commit2=`trim_obj_id 28 $new_commit2`
656 0ebf8283 2019-07-24 stsp echo "$short_old_commit1 -> $short_new_commit1: committing changes" \
657 0ebf8283 2019-07-24 stsp > $testroot/stdout.expected
658 0ebf8283 2019-07-24 stsp echo "G epsilon/zeta" >> $testroot/stdout.expected
659 0ebf8283 2019-07-24 stsp echo -n "$short_old_commit2 -> $short_new_commit2: " \
660 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
661 0ebf8283 2019-07-24 stsp echo "committing to zeta on master" >> $testroot/stdout.expected
662 0ebf8283 2019-07-24 stsp echo "Switching work tree to refs/heads/master" \
663 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
665 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
667 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
668 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
669 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
673 0ebf8283 2019-07-24 stsp echo "edited modified alpha on master" > $testroot/content.expected
674 0ebf8283 2019-07-24 stsp cat $testroot/wt/alpha > $testroot/content
675 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
677 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
678 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
679 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
683 0ebf8283 2019-07-24 stsp if [ -e $testroot/wt/beta ]; then
684 0ebf8283 2019-07-24 stsp echo "removed file beta still exists on disk" >&2
685 0ebf8283 2019-07-24 stsp test_done "$testroot" "1"
689 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/content.expected
690 0ebf8283 2019-07-24 stsp cat $testroot/wt/epsilon/new > $testroot/content
691 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
693 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
694 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
695 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
699 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
701 0ebf8283 2019-07-24 stsp echo -n > $testroot/stdout.expected
702 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
704 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
705 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
706 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
710 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
711 0ebf8283 2019-07-24 stsp echo "commit $new_commit2 (master)" > $testroot/stdout.expected
712 0ebf8283 2019-07-24 stsp echo "commit $new_commit1" >> $testroot/stdout.expected
713 0ebf8283 2019-07-24 stsp echo "commit $orig_commit" >> $testroot/stdout.expected
714 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
716 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
717 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
719 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
722 f6cae3ed 2020-09-13 naddy test_histedit_fold_last_commit() {
723 0ebf8283 2019-07-24 stsp local testroot=`test_init histedit_fold_last_commit`
725 0ebf8283 2019-07-24 stsp local orig_commit=`git_show_head $testroot/repo`
727 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
728 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git rm -q beta)
729 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/repo/epsilon/new
730 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git add epsilon/new)
731 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing changes"
732 0ebf8283 2019-07-24 stsp local old_commit1=`git_show_head $testroot/repo`
734 0ebf8283 2019-07-24 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
735 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing to zeta on master"
736 0ebf8283 2019-07-24 stsp local old_commit2=`git_show_head $testroot/repo`
738 0ebf8283 2019-07-24 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
740 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
741 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
745 0ebf8283 2019-07-24 stsp echo "pick $old_commit1" > $testroot/histedit-script
746 0ebf8283 2019-07-24 stsp echo "fold $old_commit2" >> $testroot/histedit-script
747 0ebf8283 2019-07-24 stsp echo "mesg committing folded changes" >> $testroot/histedit-script
749 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
750 0ebf8283 2019-07-24 stsp > $testroot/stdout 2> $testroot/stderr)
753 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
754 0ebf8283 2019-07-24 stsp echo "histedit succeeded unexpectedly" >&2
755 0ebf8283 2019-07-24 stsp test_done "$testroot" "1"
759 0ebf8283 2019-07-24 stsp echo "got: last commit in histedit script cannot be folded" \
760 0ebf8283 2019-07-24 stsp > $testroot/stderr.expected
762 0ebf8283 2019-07-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
764 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
765 0ebf8283 2019-07-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
767 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
770 f6cae3ed 2020-09-13 naddy test_histedit_missing_commit() {
771 0ebf8283 2019-07-24 stsp local testroot=`test_init histedit_missing_commit`
773 0ebf8283 2019-07-24 stsp local orig_commit=`git_show_head $testroot/repo`
775 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
776 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git rm -q beta)
777 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/repo/epsilon/new
778 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git add epsilon/new)
779 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing changes"
780 0ebf8283 2019-07-24 stsp local old_commit1=`git_show_head $testroot/repo`
782 0ebf8283 2019-07-24 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
783 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing to zeta on master"
784 0ebf8283 2019-07-24 stsp local old_commit2=`git_show_head $testroot/repo`
786 0ebf8283 2019-07-24 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
788 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
789 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
793 0ebf8283 2019-07-24 stsp echo "pick $old_commit1" > $testroot/histedit-script
794 0ebf8283 2019-07-24 stsp echo "mesg committing changes" >> $testroot/histedit-script
796 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
797 0ebf8283 2019-07-24 stsp > $testroot/stdout 2> $testroot/stderr)
800 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
801 0ebf8283 2019-07-24 stsp echo "histedit succeeded unexpectedly" >&2
802 0ebf8283 2019-07-24 stsp test_done "$testroot" "1"
806 0ebf8283 2019-07-24 stsp echo "got: commit $old_commit2 missing from histedit script" \
807 0ebf8283 2019-07-24 stsp > $testroot/stderr.expected
809 0ebf8283 2019-07-24 stsp cmp -s $testroot/stderr.expected $testroot/stderr
811 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
812 0ebf8283 2019-07-24 stsp diff -u $testroot/stderr.expected $testroot/stderr
814 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
817 f6cae3ed 2020-09-13 naddy test_histedit_abort() {
818 0ebf8283 2019-07-24 stsp local testroot=`test_init histedit_abort`
820 0ebf8283 2019-07-24 stsp local orig_commit=`git_show_head $testroot/repo`
822 0ebf8283 2019-07-24 stsp echo "modified alpha on master" > $testroot/repo/alpha
823 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git rm -q beta)
824 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/repo/epsilon/new
825 0ebf8283 2019-07-24 stsp (cd $testroot/repo && git add epsilon/new)
826 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing changes"
827 0ebf8283 2019-07-24 stsp local old_commit1=`git_show_head $testroot/repo`
829 0ebf8283 2019-07-24 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
830 0ebf8283 2019-07-24 stsp git_commit $testroot/repo -m "committing to zeta on master"
831 0ebf8283 2019-07-24 stsp local old_commit2=`git_show_head $testroot/repo`
833 0ebf8283 2019-07-24 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
835 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
836 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
840 d52bac28 2021-10-08 thomas # unrelated unversioned file in work tree
841 d52bac28 2021-10-08 thomas touch $testroot/wt/unversioned-file
843 0ebf8283 2019-07-24 stsp echo "edit $old_commit1" > $testroot/histedit-script
844 0ebf8283 2019-07-24 stsp echo "mesg committing changes" >> $testroot/histedit-script
845 0ebf8283 2019-07-24 stsp echo "pick $old_commit2" >> $testroot/histedit-script
847 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
848 0ebf8283 2019-07-24 stsp > $testroot/stdout)
850 0ebf8283 2019-07-24 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
851 0ebf8283 2019-07-24 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
853 0ebf8283 2019-07-24 stsp echo "G alpha" > $testroot/stdout.expected
854 0ebf8283 2019-07-24 stsp echo "D beta" >> $testroot/stdout.expected
855 0ebf8283 2019-07-24 stsp echo "A epsilon/new" >> $testroot/stdout.expected
856 0ebf8283 2019-07-24 stsp echo "Stopping histedit for amending commit $old_commit1" \
857 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
858 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
860 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
861 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
862 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
866 0ebf8283 2019-07-24 stsp echo "edited modified alpha on master" > $testroot/wt/alpha
868 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got histedit -a > $testroot/stdout)
870 0ebf8283 2019-07-24 stsp local new_commit1=`git_show_parent_commit $testroot/repo`
871 0ebf8283 2019-07-24 stsp local new_commit2=`git_show_head $testroot/repo`
873 0ebf8283 2019-07-24 stsp echo "Switching work tree to refs/heads/master" \
874 0ebf8283 2019-07-24 stsp > $testroot/stdout.expected
875 0ebf8283 2019-07-24 stsp echo "R alpha" >> $testroot/stdout.expected
876 0ebf8283 2019-07-24 stsp echo "R beta" >> $testroot/stdout.expected
877 0ebf8283 2019-07-24 stsp echo "R epsilon/new" >> $testroot/stdout.expected
878 0ebf8283 2019-07-24 stsp echo "Histedit of refs/heads/master aborted" \
879 0ebf8283 2019-07-24 stsp >> $testroot/stdout.expected
881 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
883 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
884 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
885 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
889 0ebf8283 2019-07-24 stsp for f in alpha beta; do
890 0ebf8283 2019-07-24 stsp echo "$f" > $testroot/content.expected
891 0ebf8283 2019-07-24 stsp cat $testroot/wt/$f > $testroot/content
892 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
894 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
895 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
896 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
901 0ebf8283 2019-07-24 stsp echo "new file on master" > $testroot/content.expected
902 0ebf8283 2019-07-24 stsp cat $testroot/wt/epsilon/new > $testroot/content
903 0ebf8283 2019-07-24 stsp cmp -s $testroot/content.expected $testroot/content
905 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
906 0ebf8283 2019-07-24 stsp diff -u $testroot/content.expected $testroot/content
907 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
911 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got status > $testroot/stdout)
913 0ebf8283 2019-07-24 stsp echo "? epsilon/new" > $testroot/stdout.expected
914 d52bac28 2021-10-08 thomas echo "? unversioned-file" >> $testroot/stdout.expected
915 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
917 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
918 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
919 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
923 0ebf8283 2019-07-24 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
924 0ebf8283 2019-07-24 stsp echo "commit $new_commit2 (master)" > $testroot/stdout.expected
925 0ebf8283 2019-07-24 stsp echo "commit $new_commit1" >> $testroot/stdout.expected
926 0ebf8283 2019-07-24 stsp echo "commit $orig_commit" >> $testroot/stdout.expected
927 0160a755 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
929 0160a755 2019-07-25 stsp if [ "$ret" != "0" ]; then
930 0160a755 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
932 0160a755 2019-07-25 stsp test_done "$testroot" "$ret"
935 f6cae3ed 2020-09-13 naddy test_histedit_path_prefix_drop() {
936 a4027091 2019-07-25 stsp local testroot=`test_init histedit_path_prefix_drop`
937 0160a755 2019-07-25 stsp local orig_commit=`git_show_head $testroot/repo`
939 0160a755 2019-07-25 stsp echo "modified zeta" > $testroot/repo/epsilon/zeta
940 0160a755 2019-07-25 stsp git_commit $testroot/repo -m "changing zeta"
941 0160a755 2019-07-25 stsp local old_commit1=`git_show_head $testroot/repo`
943 0160a755 2019-07-25 stsp got checkout -c $orig_commit -p gamma $testroot/repo \
944 0160a755 2019-07-25 stsp $testroot/wt > /dev/null
946 0160a755 2019-07-25 stsp if [ "$ret" != "0" ]; then
947 0160a755 2019-07-25 stsp test_done "$testroot" "$ret"
951 0160a755 2019-07-25 stsp echo "drop $old_commit1" > $testroot/histedit-script
953 0160a755 2019-07-25 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
954 0160a755 2019-07-25 stsp > $testroot/stdout 2> $testroot/stderr)
957 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
958 0160a755 2019-07-25 stsp echo "histedit succeeded unexpectedly" >&2
959 0160a755 2019-07-25 stsp test_done "$testroot" "1"
963 0160a755 2019-07-25 stsp echo -n "got: cannot edit branch history which contains changes " \
964 0160a755 2019-07-25 stsp > $testroot/stderr.expected
965 0160a755 2019-07-25 stsp echo "outside of this work tree's path prefix" \
966 0160a755 2019-07-25 stsp >> $testroot/stderr.expected
968 0160a755 2019-07-25 stsp cmp -s $testroot/stderr.expected $testroot/stderr
970 0160a755 2019-07-25 stsp if [ "$ret" != "0" ]; then
971 0160a755 2019-07-25 stsp diff -u $testroot/stderr.expected $testroot/stderr
972 0160a755 2019-07-25 stsp test_done "$testroot" "$ret"
976 0160a755 2019-07-25 stsp rm -rf $testroot/wt
977 0160a755 2019-07-25 stsp got checkout -c $orig_commit -p epsilon $testroot/repo \
978 0160a755 2019-07-25 stsp $testroot/wt > /dev/null
980 0160a755 2019-07-25 stsp if [ "$ret" != "0" ]; then
981 0160a755 2019-07-25 stsp test_done "$testroot" "$ret"
984 0160a755 2019-07-25 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
985 0160a755 2019-07-25 stsp > $testroot/stdout)
987 0160a755 2019-07-25 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
988 0160a755 2019-07-25 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
990 0160a755 2019-07-25 stsp echo "$short_old_commit1 -> drop commit: changing zeta" \
991 0160a755 2019-07-25 stsp > $testroot/stdout.expected
992 0160a755 2019-07-25 stsp echo "Switching work tree to refs/heads/master" \
993 0160a755 2019-07-25 stsp >> $testroot/stdout.expected
995 0ebf8283 2019-07-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
997 0ebf8283 2019-07-24 stsp if [ "$ret" != "0" ]; then
998 0ebf8283 2019-07-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
999 0160a755 2019-07-25 stsp test_done "$testroot" "$ret"
1003 0160a755 2019-07-25 stsp echo "zeta" > $testroot/content.expected
1004 0160a755 2019-07-25 stsp cat $testroot/wt/zeta > $testroot/content
1005 0160a755 2019-07-25 stsp cmp -s $testroot/content.expected $testroot/content
1007 0160a755 2019-07-25 stsp if [ "$ret" != "0" ]; then
1008 0160a755 2019-07-25 stsp diff -u $testroot/content.expected $testroot/content
1009 0160a755 2019-07-25 stsp test_done "$testroot" "$ret"
1014 0160a755 2019-07-25 stsp (cd $testroot/wt && got status > $testroot/stdout)
1016 0160a755 2019-07-25 stsp echo -n > $testroot/stdout.expected
1017 0160a755 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1019 0160a755 2019-07-25 stsp if [ "$ret" != "0" ]; then
1020 0160a755 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1021 0160a755 2019-07-25 stsp test_done "$testroot" "$ret"
1025 0160a755 2019-07-25 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1026 0160a755 2019-07-25 stsp echo "commit $orig_commit (master)" > $testroot/stdout.expected
1027 b2c50a0a 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1029 b2c50a0a 2019-07-25 stsp if [ "$ret" != "0" ]; then
1030 b2c50a0a 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1032 b2c50a0a 2019-07-25 stsp test_done "$testroot" "$ret"
1035 f6cae3ed 2020-09-13 naddy test_histedit_path_prefix_edit() {
1036 b2c50a0a 2019-07-25 stsp local testroot=`test_init histedit_path_prefix_edit`
1037 b2c50a0a 2019-07-25 stsp local orig_commit=`git_show_head $testroot/repo`
1039 b2c50a0a 2019-07-25 stsp echo "modified zeta" > $testroot/repo/epsilon/zeta
1040 b2c50a0a 2019-07-25 stsp git_commit $testroot/repo -m "changing zeta"
1041 b2c50a0a 2019-07-25 stsp local old_commit1=`git_show_head $testroot/repo`
1043 b2c50a0a 2019-07-25 stsp got diff -r $testroot/repo $orig_commit $old_commit1 \
1044 b2c50a0a 2019-07-25 stsp > $testroot/diff.expected
1046 b2c50a0a 2019-07-25 stsp got checkout -c $orig_commit -p gamma $testroot/repo \
1047 b2c50a0a 2019-07-25 stsp $testroot/wt > /dev/null
1049 b2c50a0a 2019-07-25 stsp if [ "$ret" != "0" ]; then
1050 b2c50a0a 2019-07-25 stsp test_done "$testroot" "$ret"
1054 b2c50a0a 2019-07-25 stsp echo "edit $old_commit1" > $testroot/histedit-script
1055 b2c50a0a 2019-07-25 stsp echo "mesg modified zeta" >> $testroot/histedit-script
1057 b2c50a0a 2019-07-25 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1058 b2c50a0a 2019-07-25 stsp > $testroot/stdout 2> $testroot/stderr)
1061 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
1062 b2c50a0a 2019-07-25 stsp echo "histedit succeeded unexpectedly" >&2
1063 b2c50a0a 2019-07-25 stsp test_done "$testroot" "1"
1067 b2c50a0a 2019-07-25 stsp echo -n "got: cannot edit branch history which contains changes " \
1068 b2c50a0a 2019-07-25 stsp > $testroot/stderr.expected
1069 b2c50a0a 2019-07-25 stsp echo "outside of this work tree's path prefix" \
1070 b2c50a0a 2019-07-25 stsp >> $testroot/stderr.expected
1072 b2c50a0a 2019-07-25 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1074 b2c50a0a 2019-07-25 stsp if [ "$ret" != "0" ]; then
1075 b2c50a0a 2019-07-25 stsp diff -u $testroot/stderr.expected $testroot/stderr
1076 b2c50a0a 2019-07-25 stsp test_done "$testroot" "$ret"
1080 b2c50a0a 2019-07-25 stsp rm -rf $testroot/wt
1081 b2c50a0a 2019-07-25 stsp got checkout -c $orig_commit -p epsilon $testroot/repo \
1082 b2c50a0a 2019-07-25 stsp $testroot/wt > /dev/null
1084 b2c50a0a 2019-07-25 stsp if [ "$ret" != "0" ]; then
1085 b2c50a0a 2019-07-25 stsp test_done "$testroot" "$ret"
1088 b2c50a0a 2019-07-25 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1089 b2c50a0a 2019-07-25 stsp > $testroot/stdout)
1091 b2c50a0a 2019-07-25 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
1093 b2c50a0a 2019-07-25 stsp echo "G zeta" > $testroot/stdout.expected
1094 b2c50a0a 2019-07-25 stsp echo "Stopping histedit for amending commit $old_commit1" \
1095 b2c50a0a 2019-07-25 stsp >> $testroot/stdout.expected
1096 0160a755 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1098 0160a755 2019-07-25 stsp if [ "$ret" != "0" ]; then
1099 0160a755 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1100 b2c50a0a 2019-07-25 stsp test_done "$testroot" "$ret"
1104 b2c50a0a 2019-07-25 stsp echo "modified zeta" > $testroot/content.expected
1105 b2c50a0a 2019-07-25 stsp cat $testroot/wt/zeta > $testroot/content
1106 b2c50a0a 2019-07-25 stsp cmp -s $testroot/content.expected $testroot/content
1108 b2c50a0a 2019-07-25 stsp if [ "$ret" != "0" ]; then
1109 b2c50a0a 2019-07-25 stsp diff -u $testroot/content.expected $testroot/content
1110 b2c50a0a 2019-07-25 stsp test_done "$testroot" "$ret"
1114 b2c50a0a 2019-07-25 stsp (cd $testroot/wt && got status > $testroot/stdout)
1116 b2c50a0a 2019-07-25 stsp echo "M zeta"> $testroot/stdout.expected
1117 b2c50a0a 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1119 b2c50a0a 2019-07-25 stsp if [ "$ret" != "0" ]; then
1120 b2c50a0a 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1121 b2c50a0a 2019-07-25 stsp test_done "$testroot" "$ret"
1125 b2c50a0a 2019-07-25 stsp (cd $testroot/wt && got histedit -c > $testroot/stdout)
1127 b2c50a0a 2019-07-25 stsp local new_commit1=`git_show_head $testroot/repo`
1128 b2c50a0a 2019-07-25 stsp local short_new_commit1=`trim_obj_id 28 $new_commit1`
1130 b2c50a0a 2019-07-25 stsp echo -n "$short_old_commit1 -> $short_new_commit1: " \
1131 b2c50a0a 2019-07-25 stsp > $testroot/stdout.expected
1132 b2c50a0a 2019-07-25 stsp echo "modified zeta" >> $testroot/stdout.expected
1133 b2c50a0a 2019-07-25 stsp echo "Switching work tree to refs/heads/master" \
1134 b2c50a0a 2019-07-25 stsp >> $testroot/stdout.expected
1136 b2c50a0a 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1138 b2c50a0a 2019-07-25 stsp if [ "$ret" != "0" ]; then
1139 b2c50a0a 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1140 b2c50a0a 2019-07-25 stsp test_done "$testroot" "$ret"
1144 b2c50a0a 2019-07-25 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1145 b2c50a0a 2019-07-25 stsp echo "commit $new_commit1 (master)" > $testroot/stdout.expected
1146 b2c50a0a 2019-07-25 stsp echo "commit $orig_commit" >> $testroot/stdout.expected
1147 b2c50a0a 2019-07-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1149 b2c50a0a 2019-07-25 stsp if [ "$ret" != "0" ]; then
1150 b2c50a0a 2019-07-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
1151 b2c50a0a 2019-07-25 stsp test_done "$testroot" "$ret"
1155 b2c50a0a 2019-07-25 stsp got diff -r $testroot/repo $orig_commit $new_commit1 \
1156 b2c50a0a 2019-07-25 stsp > $testroot/diff
1157 fa37079f 2021-10-09 thomas sed -i '' -e "s/$old_commit1/$new_commit1/" $testroot/diff.expected
1158 b2c50a0a 2019-07-25 stsp cmp -s $testroot/diff.expected $testroot/diff
1160 b2c50a0a 2019-07-25 stsp if [ "$ret" != "0" ]; then
1161 b2c50a0a 2019-07-25 stsp diff -u $testroot/diff.expected $testroot/diff
1163 0ebf8283 2019-07-24 stsp test_done "$testroot" "$ret"
1166 f6cae3ed 2020-09-13 naddy test_histedit_outside_refs_heads() {
1167 c7d20a3f 2019-07-30 stsp local testroot=`test_init histedit_outside_refs_heads`
1168 c7d20a3f 2019-07-30 stsp local commit1=`git_show_head $testroot/repo`
1170 c7d20a3f 2019-07-30 stsp got checkout $testroot/repo $testroot/wt > /dev/null
1172 c7d20a3f 2019-07-30 stsp if [ "$ret" != "0" ]; then
1173 c7d20a3f 2019-07-30 stsp echo "got checkout failed unexpectedly"
1174 c7d20a3f 2019-07-30 stsp test_done "$testroot" "$ret"
1178 c7d20a3f 2019-07-30 stsp echo "modified alpha" > $testroot/wt/alpha
1180 c7d20a3f 2019-07-30 stsp (cd $testroot/wt && got commit -m 'change alpha' \
1181 c7d20a3f 2019-07-30 stsp > $testroot/stdout 2> $testroot/stderr)
1183 c7d20a3f 2019-07-30 stsp if [ "$ret" != "0" ]; then
1184 c7d20a3f 2019-07-30 stsp echo "got commit failed unexpectedly" >&2
1185 c7d20a3f 2019-07-30 stsp test_done "$testroot" "1"
1188 c7d20a3f 2019-07-30 stsp local commit2=`git_show_head $testroot/repo`
1190 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c master refs/remotes/origin/master
1192 c7d20a3f 2019-07-30 stsp if [ "$ret" != "0" ]; then
1193 c7d20a3f 2019-07-30 stsp echo "got ref failed unexpectedly" >&2
1194 c7d20a3f 2019-07-30 stsp test_done "$testroot" "1"
1198 c7d20a3f 2019-07-30 stsp (cd $testroot/wt && got update -b origin/master -c $commit1 >/dev/null)
1200 c7d20a3f 2019-07-30 stsp if [ "$ret" != "0" ]; then
1201 c7d20a3f 2019-07-30 stsp echo "got update failed unexpectedly"
1202 c7d20a3f 2019-07-30 stsp test_done "$testroot" "$ret"
1206 c7d20a3f 2019-07-30 stsp echo "edit $commit2" > $testroot/histedit-script
1207 c7d20a3f 2019-07-30 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1208 c7d20a3f 2019-07-30 stsp 2> $testroot/stderr)
1210 c7d20a3f 2019-07-30 stsp echo -n "got: will not edit commit history of a branch outside the " \
1211 c7d20a3f 2019-07-30 stsp > $testroot/stderr.expected
1212 c7d20a3f 2019-07-30 stsp echo '"refs/heads/" reference namespace' \
1213 c7d20a3f 2019-07-30 stsp >> $testroot/stderr.expected
1214 c7d20a3f 2019-07-30 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1216 c7d20a3f 2019-07-30 stsp if [ "$ret" != "0" ]; then
1217 c7d20a3f 2019-07-30 stsp diff -u $testroot/stderr.expected $testroot/stderr
1219 0def28b1 2019-08-17 stsp test_done "$testroot" "$ret"
1222 f6cae3ed 2020-09-13 naddy test_histedit_fold_last_commit_swap() {
1223 0def28b1 2019-08-17 stsp local testroot=`test_init histedit_fold_last_commit_swap`
1225 0def28b1 2019-08-17 stsp local orig_commit=`git_show_head $testroot/repo`
1227 0def28b1 2019-08-17 stsp echo "modified alpha on master" > $testroot/repo/alpha
1228 0def28b1 2019-08-17 stsp (cd $testroot/repo && git rm -q beta)
1229 0def28b1 2019-08-17 stsp echo "new file on master" > $testroot/repo/epsilon/new
1230 0def28b1 2019-08-17 stsp (cd $testroot/repo && git add epsilon/new)
1231 0def28b1 2019-08-17 stsp git_commit $testroot/repo -m "committing changes"
1232 0def28b1 2019-08-17 stsp local old_commit1=`git_show_head $testroot/repo`
1234 0def28b1 2019-08-17 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1235 0def28b1 2019-08-17 stsp git_commit $testroot/repo -m "committing to zeta on master"
1236 0def28b1 2019-08-17 stsp local old_commit2=`git_show_head $testroot/repo`
1238 0def28b1 2019-08-17 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1240 0def28b1 2019-08-17 stsp if [ "$ret" != "0" ]; then
1241 0def28b1 2019-08-17 stsp test_done "$testroot" "$ret"
1245 0def28b1 2019-08-17 stsp # fold commit2 into commit1 (requires swapping commits)
1246 0def28b1 2019-08-17 stsp echo "fold $old_commit2" > $testroot/histedit-script
1247 0def28b1 2019-08-17 stsp echo "pick $old_commit1" >> $testroot/histedit-script
1248 0def28b1 2019-08-17 stsp echo "mesg committing folded changes" >> $testroot/histedit-script
1250 0def28b1 2019-08-17 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1251 0def28b1 2019-08-17 stsp > $testroot/stdout 2> $testroot/stderr)
1254 0def28b1 2019-08-17 stsp if [ "$ret" != "0" ]; then
1255 0def28b1 2019-08-17 stsp echo "histedit failed unexpectedly" >&2
1256 0def28b1 2019-08-17 stsp test_done "$testroot" "$ret"
1260 0def28b1 2019-08-17 stsp local new_commit=`git_show_head $testroot/repo`
1262 0def28b1 2019-08-17 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
1263 0def28b1 2019-08-17 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
1264 0def28b1 2019-08-17 stsp local short_new_commit=`trim_obj_id 28 $new_commit`
1266 0def28b1 2019-08-17 stsp echo "G epsilon/zeta" >> $testroot/stdout.expected
1267 0def28b1 2019-08-17 stsp echo -n "$short_old_commit2 -> fold commit: committing to zeta " \
1268 0def28b1 2019-08-17 stsp >> $testroot/stdout.expected
1269 0def28b1 2019-08-17 stsp echo "on master" >> $testroot/stdout.expected
1270 0def28b1 2019-08-17 stsp echo "G alpha" >> $testroot/stdout.expected
1271 0def28b1 2019-08-17 stsp echo "D beta" >> $testroot/stdout.expected
1272 0def28b1 2019-08-17 stsp echo "A epsilon/new" >> $testroot/stdout.expected
1273 0def28b1 2019-08-17 stsp echo -n "$short_old_commit1 -> $short_new_commit: " \
1274 0def28b1 2019-08-17 stsp >> $testroot/stdout.expected
1275 0def28b1 2019-08-17 stsp echo "committing folded changes" >> $testroot/stdout.expected
1276 0def28b1 2019-08-17 stsp echo "Switching work tree to refs/heads/master" \
1277 0def28b1 2019-08-17 stsp >> $testroot/stdout.expected
1279 0def28b1 2019-08-17 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1281 0def28b1 2019-08-17 stsp if [ "$ret" != "0" ]; then
1282 0def28b1 2019-08-17 stsp diff -u $testroot/stdout.expected $testroot/stdout
1284 c7d20a3f 2019-07-30 stsp test_done "$testroot" "$ret"
1287 f6cae3ed 2020-09-13 naddy test_histedit_split_commit() {
1288 de05890f 2020-03-05 stsp local testroot=`test_init histedit_split_commit`
1290 de05890f 2020-03-05 stsp local orig_commit=`git_show_head $testroot/repo`
1292 de05890f 2020-03-05 stsp echo "modified alpha on master" > $testroot/repo/alpha
1293 de05890f 2020-03-05 stsp (cd $testroot/repo && git rm -q beta)
1294 de05890f 2020-03-05 stsp echo "new file on master" > $testroot/repo/epsilon/new
1295 de05890f 2020-03-05 stsp (cd $testroot/repo && git add epsilon/new)
1296 de05890f 2020-03-05 stsp git_commit $testroot/repo -m "committing changes 1"
1297 de05890f 2020-03-05 stsp local old_commit1=`git_show_head $testroot/repo`
1298 de05890f 2020-03-05 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
1300 de05890f 2020-03-05 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1301 de05890f 2020-03-05 stsp git_commit $testroot/repo -m "committing changes 2"
1302 de05890f 2020-03-05 stsp local old_commit2=`git_show_head $testroot/repo`
1303 de05890f 2020-03-05 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
1305 de05890f 2020-03-05 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1307 de05890f 2020-03-05 stsp if [ "$ret" != "0" ]; then
1308 de05890f 2020-03-05 stsp test_done "$testroot" "$ret"
1312 de05890f 2020-03-05 stsp # split commit1 into commitA and commitB and commitC
1313 de05890f 2020-03-05 stsp echo "e $old_commit1" > $testroot/histedit-script
1314 de05890f 2020-03-05 stsp echo "p $old_commit2" >> $testroot/histedit-script
1316 de05890f 2020-03-05 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1317 de05890f 2020-03-05 stsp > $testroot/stdout 2> $testroot/stderr)
1319 de05890f 2020-03-05 stsp if [ "$ret" != "0" ]; then
1320 de05890f 2020-03-05 stsp echo "histedit failed unexpectedly:" >&2
1321 de05890f 2020-03-05 stsp cat $testroot/stderr >&2
1322 de05890f 2020-03-05 stsp test_done "$testroot" "$ret"
1326 de05890f 2020-03-05 stsp echo "G alpha" > $testroot/stdout.expected
1327 de05890f 2020-03-05 stsp echo "D beta" >> $testroot/stdout.expected
1328 de05890f 2020-03-05 stsp echo "A epsilon/new" >> $testroot/stdout.expected
1329 de05890f 2020-03-05 stsp echo "Stopping histedit for amending commit $old_commit1" \
1330 de05890f 2020-03-05 stsp >> $testroot/stdout.expected
1332 de05890f 2020-03-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1334 de05890f 2020-03-05 stsp if [ "$ret" != "0" ]; then
1335 de05890f 2020-03-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1336 de05890f 2020-03-05 stsp test_done "$testroot" "$ret"
1340 de05890f 2020-03-05 stsp (cd $testroot/wt && got ci -m "commitA" alpha >/dev/null)
1342 de05890f 2020-03-05 stsp if [ "$ret" != "0" ]; then
1343 de05890f 2020-03-05 stsp echo "commit failed unexpectedly" >&2
1344 de05890f 2020-03-05 stsp test_done "$testroot" "$ret"
1348 de05890f 2020-03-05 stsp (cd $testroot/wt && got ci -m "commitB" beta >/dev/null)
1350 de05890f 2020-03-05 stsp if [ "$ret" != "0" ]; then
1351 de05890f 2020-03-05 stsp echo "commit failed unexpectedly" >&2
1352 de05890f 2020-03-05 stsp test_done "$testroot" "$ret"
1356 de05890f 2020-03-05 stsp (cd $testroot/wt && got ci -m "commitC" epsilon/new >/dev/null)
1358 de05890f 2020-03-05 stsp if [ "$ret" != "0" ]; then
1359 de05890f 2020-03-05 stsp echo "commit failed unexpectedly" >&2
1360 de05890f 2020-03-05 stsp test_done "$testroot" "$ret"
1364 de05890f 2020-03-05 stsp (cd $testroot/wt && got histedit -c \
1365 de05890f 2020-03-05 stsp > $testroot/stdout 2> $testroot/stderr)
1367 de05890f 2020-03-05 stsp if [ "$ret" != "0" ]; then
1368 de05890f 2020-03-05 stsp echo "histedit failed unexpectedly:" >&2
1369 de05890f 2020-03-05 stsp cat $testroot/stderr >&2
1370 de05890f 2020-03-05 stsp test_done "$testroot" "$ret"
1373 de05890f 2020-03-05 stsp local new_commit2=`git_show_head $testroot/repo`
1374 de05890f 2020-03-05 stsp local short_new_commit2=`trim_obj_id 28 $new_commit2`
1376 de05890f 2020-03-05 stsp echo "$short_old_commit1 -> no-op change: committing changes 1" \
1377 de05890f 2020-03-05 stsp > $testroot/stdout.expected
1378 de05890f 2020-03-05 stsp echo "G epsilon/zeta" >> $testroot/stdout.expected
1379 de05890f 2020-03-05 stsp echo "$short_old_commit2 -> $short_new_commit2: committing changes 2" \
1380 de05890f 2020-03-05 stsp >> $testroot/stdout.expected
1381 de05890f 2020-03-05 stsp echo "Switching work tree to refs/heads/master" \
1382 de05890f 2020-03-05 stsp >> $testroot/stdout.expected
1384 de05890f 2020-03-05 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1386 de05890f 2020-03-05 stsp if [ "$ret" != "0" ]; then
1387 de05890f 2020-03-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
1389 5b87815e 2020-03-05 stsp test_done "$testroot" "$ret"
1393 f6cae3ed 2020-09-13 naddy test_histedit_duplicate_commit_in_script() {
1394 5b87815e 2020-03-05 stsp local testroot=`test_init histedit_duplicate_commit_in_script`
1396 5b87815e 2020-03-05 stsp local orig_commit=`git_show_head $testroot/repo`
1398 5b87815e 2020-03-05 stsp echo "modified alpha on master" > $testroot/repo/alpha
1399 5b87815e 2020-03-05 stsp (cd $testroot/repo && git rm -q beta)
1400 5b87815e 2020-03-05 stsp echo "new file on master" > $testroot/repo/epsilon/new
1401 5b87815e 2020-03-05 stsp (cd $testroot/repo && git add epsilon/new)
1402 5b87815e 2020-03-05 stsp git_commit $testroot/repo -m "committing changes 1"
1403 5b87815e 2020-03-05 stsp local old_commit1=`git_show_head $testroot/repo`
1405 5b87815e 2020-03-05 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1406 5b87815e 2020-03-05 stsp git_commit $testroot/repo -m "committing changes 2"
1407 5b87815e 2020-03-05 stsp local old_commit2=`git_show_head $testroot/repo`
1409 5b87815e 2020-03-05 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1411 5b87815e 2020-03-05 stsp if [ "$ret" != "0" ]; then
1412 5b87815e 2020-03-05 stsp test_done "$testroot" "$ret"
1416 5b87815e 2020-03-05 stsp # This histedit script lists commit1 more than once
1417 5b87815e 2020-03-05 stsp echo "p $old_commit1" > $testroot/histedit-script
1418 5b87815e 2020-03-05 stsp echo "p $old_commit1" >> $testroot/histedit-script
1419 5b87815e 2020-03-05 stsp echo "p $old_commit2" >> $testroot/histedit-script
1421 5b87815e 2020-03-05 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1422 5b87815e 2020-03-05 stsp > $testroot/stdout 2> $testroot/stderr)
1424 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
1425 5b87815e 2020-03-05 stsp echo "histedit succeeded unexpectedly:" >&2
1426 5b87815e 2020-03-05 stsp cat $testroot/stdout >&2
1427 5b87815e 2020-03-05 stsp test_done "$testroot" "$ret"
1431 5b87815e 2020-03-05 stsp echo -n "got: commit $old_commit1 is listed more than once " \
1432 5b87815e 2020-03-05 stsp > $testroot/stderr.expected
1433 5b87815e 2020-03-05 stsp echo "in histedit script" >> $testroot/stderr.expected
1435 5b87815e 2020-03-05 stsp cmp -s $testroot/stderr.expected $testroot/stderr
1437 5b87815e 2020-03-05 stsp if [ "$ret" != "0" ]; then
1438 5b87815e 2020-03-05 stsp diff -u $testroot/stderr.expected $testroot/stderr
1440 de05890f 2020-03-05 stsp test_done "$testroot" "$ret"
1444 ecfff807 2020-09-23 stsp # if a previous commit introduces a new file, and it is folded into a commit
1445 ecfff807 2020-09-23 stsp # that deletes the same file, the file still exists after the histedit
1446 ecfff807 2020-09-23 stsp test_histedit_fold_add_delete() {
1447 4c662b1d 2021-09-01 stsp local testroot=`test_init histedit_fold_add_delete`
1449 ecfff807 2020-09-23 stsp local orig_commit=`git_show_head $testroot/repo`
1451 ecfff807 2020-09-23 stsp echo "added new file epsilon/psi" > $testroot/repo/epsilon/psi
1452 ecfff807 2020-09-23 stsp (cd $testroot/repo && git add epsilon/psi)
1453 ecfff807 2020-09-23 stsp git_commit $testroot/repo -m "committing changes"
1454 ecfff807 2020-09-23 stsp local old_commit1=`git_show_head $testroot/repo`
1456 ecfff807 2020-09-23 stsp echo "modified epsilon/psi" > $testroot/repo/epsilon/psi
1457 ecfff807 2020-09-23 stsp git_commit $testroot/repo -m "editing psi"
1458 ecfff807 2020-09-23 stsp local old_commit2=`git_show_head $testroot/repo`
1460 ecfff807 2020-09-23 stsp (cd $testroot/repo && git rm -q epsilon/psi)
1461 ecfff807 2020-09-23 stsp git_commit $testroot/repo -m "removing psi"
1462 ecfff807 2020-09-23 stsp local old_commit3=`git_show_head $testroot/repo`
1464 ecfff807 2020-09-23 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1466 ecfff807 2020-09-23 stsp if [ "$ret" != "0" ]; then
1467 ecfff807 2020-09-23 stsp test_done "$testroot" "$ret"
1471 ecfff807 2020-09-23 stsp echo "fold $old_commit1" > $testroot/histedit-script
1472 ecfff807 2020-09-23 stsp echo "fold $old_commit2" >> $testroot/histedit-script
1473 ecfff807 2020-09-23 stsp echo "pick $old_commit3" >> $testroot/histedit-script
1474 ecfff807 2020-09-23 stsp echo "mesg folded changes" >> $testroot/histedit-script
1476 ecfff807 2020-09-23 stsp (cd $testroot/wt && got histedit -F $testroot/histedit-script \
1477 ecfff807 2020-09-23 stsp > $testroot/stdout)
1479 ecfff807 2020-09-23 stsp local new_commit1=`git_show_head $testroot/repo`
1481 ecfff807 2020-09-23 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
1482 ecfff807 2020-09-23 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
1483 ecfff807 2020-09-23 stsp local short_old_commit3=`trim_obj_id 28 $old_commit3`
1484 ecfff807 2020-09-23 stsp local short_new_commit1=`trim_obj_id 28 $new_commit1`
1486 ecfff807 2020-09-23 stsp echo "A epsilon/psi" >> $testroot/stdout.expected
1487 ecfff807 2020-09-23 stsp echo "$short_old_commit1 -> fold commit: committing changes" \
1488 ecfff807 2020-09-23 stsp >> $testroot/stdout.expected
1489 ecfff807 2020-09-23 stsp echo "G epsilon/psi" >> $testroot/stdout.expected
1490 ecfff807 2020-09-23 stsp echo "$short_old_commit2 -> fold commit: editing psi" \
1491 ecfff807 2020-09-23 stsp >> $testroot/stdout.expected
1492 0a22ca1a 2020-09-23 stsp echo "D epsilon/psi" >> $testroot/stdout.expected
1493 0a22ca1a 2020-09-23 stsp echo "$short_old_commit3 -> no-op change: folded changes" \
1494 ecfff807 2020-09-23 stsp >> $testroot/stdout.expected
1495 ecfff807 2020-09-23 stsp echo "Switching work tree to refs/heads/master" \
1496 ecfff807 2020-09-23 stsp >> $testroot/stdout.expected
1498 ecfff807 2020-09-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1500 ecfff807 2020-09-23 stsp if [ "$ret" != "0" ]; then
1501 ecfff807 2020-09-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1502 ecfff807 2020-09-23 stsp test_done "$testroot" "$ret"
1506 ecfff807 2020-09-23 stsp if [ -e $testroot/wt/epsilon/psi ]; then
1507 0a22ca1a 2020-09-23 stsp echo "removed file psi still exists on disk" >&2
1508 0a22ca1a 2020-09-23 stsp test_done "$testroot" "1"
1512 ecfff807 2020-09-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
1514 ecfff807 2020-09-23 stsp echo -n > $testroot/stdout.expected
1515 ecfff807 2020-09-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1517 ecfff807 2020-09-23 stsp if [ "$ret" != "0" ]; then
1518 ecfff807 2020-09-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1519 ecfff807 2020-09-23 stsp test_done "$testroot" "$ret"
1523 ecfff807 2020-09-23 stsp (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1524 ecfff807 2020-09-23 stsp echo "commit $new_commit1 (master)" > $testroot/stdout.expected
1525 29c68398 2020-09-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1527 29c68398 2020-09-24 stsp if [ "$ret" != "0" ]; then
1528 29c68398 2020-09-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
1529 29c68398 2020-09-24 stsp test_done "$testroot" "$ret"
1533 29c68398 2020-09-24 stsp got tree -r $testroot/repo epsilon > $testroot/stdout
1534 29c68398 2020-09-24 stsp echo "zeta" > $testroot/stdout.expected
1535 ecfff807 2020-09-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1537 ecfff807 2020-09-23 stsp if [ "$ret" != "0" ]; then
1538 ecfff807 2020-09-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
1540 ecfff807 2020-09-23 stsp test_done "$testroot" "$ret"
1543 239f5c5a 2020-12-13 stsp test_histedit_fold_only() {
1544 239f5c5a 2020-12-13 stsp local testroot=`test_init histedit_fold_only`
1546 239f5c5a 2020-12-13 stsp local orig_commit=`git_show_head $testroot/repo`
1548 239f5c5a 2020-12-13 stsp echo "modified alpha on master" > $testroot/repo/alpha
1549 239f5c5a 2020-12-13 stsp (cd $testroot/repo && git rm -q beta)
1550 239f5c5a 2020-12-13 stsp echo "new file on master" > $testroot/repo/epsilon/new
1551 239f5c5a 2020-12-13 stsp (cd $testroot/repo && git add epsilon/new)
1552 239f5c5a 2020-12-13 stsp git_commit $testroot/repo -m "committing changes"
1553 239f5c5a 2020-12-13 stsp local old_commit1=`git_show_head $testroot/repo`
1555 239f5c5a 2020-12-13 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1556 239f5c5a 2020-12-13 stsp git_commit $testroot/repo -m "committing to zeta on master"
1557 239f5c5a 2020-12-13 stsp local old_commit2=`git_show_head $testroot/repo`
1559 239f5c5a 2020-12-13 stsp echo "modified delta on master" > $testroot/repo/gamma/delta
1560 239f5c5a 2020-12-13 stsp git_commit $testroot/repo -m "committing to delta on master"
1561 239f5c5a 2020-12-13 stsp local old_commit3=`git_show_head $testroot/repo`
1563 239f5c5a 2020-12-13 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1565 239f5c5a 2020-12-13 stsp if [ "$ret" != "0" ]; then
1566 239f5c5a 2020-12-13 stsp test_done "$testroot" "$ret"
1570 239f5c5a 2020-12-13 stsp cat > $testroot/editor.sh <<EOF
1572 c206b220 2021-10-09 thomas SOPTS='-i ""'
1573 c206b220 2021-10-09 thomas [ "\$OSTYPE" = "linux-gnu" ] && SOPTS="-i"
1574 c206b220 2021-10-09 thomas sed "\$SOPTS" -e 's/.*/committing folded changes/' "\$1"
1576 239f5c5a 2020-12-13 stsp chmod +x $testroot/editor.sh
1578 239f5c5a 2020-12-13 stsp (cd $testroot/wt && env EDITOR="$testroot/editor.sh" \
1579 239f5c5a 2020-12-13 stsp VISUAL="$testroot/editor.sh" got histedit -f > $testroot/stdout)
1581 239f5c5a 2020-12-13 stsp local new_commit1=`git_show_head $testroot/repo`
1583 239f5c5a 2020-12-13 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
1584 239f5c5a 2020-12-13 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
1585 239f5c5a 2020-12-13 stsp local short_old_commit3=`trim_obj_id 28 $old_commit3`
1586 239f5c5a 2020-12-13 stsp local short_new_commit1=`trim_obj_id 28 $new_commit1`
1587 239f5c5a 2020-12-13 stsp local short_new_commit2=`trim_obj_id 28 $new_commit2`
1589 239f5c5a 2020-12-13 stsp echo "G alpha" > $testroot/stdout.expected
1590 239f5c5a 2020-12-13 stsp echo "D beta" >> $testroot/stdout.expected
1591 239f5c5a 2020-12-13 stsp echo "A epsilon/new" >> $testroot/stdout.expected
1592 239f5c5a 2020-12-13 stsp echo "$short_old_commit1 -> fold commit: committing changes" \
1593 239f5c5a 2020-12-13 stsp >> $testroot/stdout.expected
1594 239f5c5a 2020-12-13 stsp echo "G epsilon/zeta" >> $testroot/stdout.expected
1595 239f5c5a 2020-12-13 stsp echo -n "$short_old_commit2 -> " >> $testroot/stdout.expected
1596 239f5c5a 2020-12-13 stsp echo "fold commit: committing to zeta on master" \
1597 239f5c5a 2020-12-13 stsp >> $testroot/stdout.expected
1598 239f5c5a 2020-12-13 stsp echo "G gamma/delta" >> $testroot/stdout.expected
1599 239f5c5a 2020-12-13 stsp echo -n "$short_old_commit3 -> $short_new_commit1: " \
1600 239f5c5a 2020-12-13 stsp >> $testroot/stdout.expected
1601 239f5c5a 2020-12-13 stsp echo "committing folded changes" >> $testroot/stdout.expected
1602 239f5c5a 2020-12-13 stsp echo "Switching work tree to refs/heads/master" \
1603 239f5c5a 2020-12-13 stsp >> $testroot/stdout.expected
1605 239f5c5a 2020-12-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1607 239f5c5a 2020-12-13 stsp if [ "$ret" != "0" ]; then
1608 239f5c5a 2020-12-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1609 239f5c5a 2020-12-13 stsp test_done "$testroot" "$ret"
1613 239f5c5a 2020-12-13 stsp echo "modified alpha on master" > $testroot/content.expected
1614 239f5c5a 2020-12-13 stsp cat $testroot/wt/alpha > $testroot/content
1615 239f5c5a 2020-12-13 stsp cmp -s $testroot/content.expected $testroot/content
1617 239f5c5a 2020-12-13 stsp if [ "$ret" != "0" ]; then
1618 239f5c5a 2020-12-13 stsp diff -u $testroot/content.expected $testroot/content
1619 239f5c5a 2020-12-13 stsp test_done "$testroot" "$ret"
1623 239f5c5a 2020-12-13 stsp if [ -e $testroot/wt/beta ]; then
1624 239f5c5a 2020-12-13 stsp echo "removed file beta still exists on disk" >&2
1625 239f5c5a 2020-12-13 stsp test_done "$testroot" "1"
1629 239f5c5a 2020-12-13 stsp echo "new file on master" > $testroot/content.expected
1630 239f5c5a 2020-12-13 stsp cat $testroot/wt/epsilon/new > $testroot/content
1631 239f5c5a 2020-12-13 stsp cmp -s $testroot/content.expected $testroot/content
1633 239f5c5a 2020-12-13 stsp if [ "$ret" != "0" ]; then
1634 239f5c5a 2020-12-13 stsp diff -u $testroot/content.expected $testroot/content
1635 239f5c5a 2020-12-13 stsp test_done "$testroot" "$ret"
1639 239f5c5a 2020-12-13 stsp (cd $testroot/wt && got status > $testroot/stdout)
1641 239f5c5a 2020-12-13 stsp echo -n > $testroot/stdout.expected
1642 239f5c5a 2020-12-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1644 239f5c5a 2020-12-13 stsp if [ "$ret" != "0" ]; then
1645 239f5c5a 2020-12-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1646 239f5c5a 2020-12-13 stsp test_done "$testroot" "$ret"
1650 239f5c5a 2020-12-13 stsp (cd $testroot/wt && got log | grep ^commit > $testroot/stdout)
1651 239f5c5a 2020-12-13 stsp echo "commit $new_commit1 (master)" > $testroot/stdout.expected
1652 239f5c5a 2020-12-13 stsp echo "commit $orig_commit" >> $testroot/stdout.expected
1653 239f5c5a 2020-12-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1655 239f5c5a 2020-12-13 stsp if [ "$ret" != "0" ]; then
1656 239f5c5a 2020-12-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1658 239f5c5a 2020-12-13 stsp test_done "$testroot" "$ret"
1661 a347e6bb 2020-12-13 stsp test_histedit_fold_only_empty_logmsg() {
1662 a347e6bb 2020-12-13 stsp local testroot=`test_init histedit_fold_only_empty_logmsg`
1664 a347e6bb 2020-12-13 stsp local orig_commit=`git_show_head $testroot/repo`
1666 a347e6bb 2020-12-13 stsp echo "modified alpha on master" > $testroot/repo/alpha
1667 a347e6bb 2020-12-13 stsp (cd $testroot/repo && git rm -q beta)
1668 a347e6bb 2020-12-13 stsp echo "new file on master" > $testroot/repo/epsilon/new
1669 a347e6bb 2020-12-13 stsp (cd $testroot/repo && git add epsilon/new)
1670 a347e6bb 2020-12-13 stsp git_commit $testroot/repo -m "committing changes"
1671 a347e6bb 2020-12-13 stsp local old_commit1=`git_show_head $testroot/repo`
1673 a347e6bb 2020-12-13 stsp echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1674 a347e6bb 2020-12-13 stsp git_commit $testroot/repo -m "committing to zeta on master"
1675 a347e6bb 2020-12-13 stsp local old_commit2=`git_show_head $testroot/repo`
1677 a347e6bb 2020-12-13 stsp echo "modified delta on master" > $testroot/repo/gamma/delta
1678 a347e6bb 2020-12-13 stsp git_commit $testroot/repo -m "committing to delta on master"
1679 a347e6bb 2020-12-13 stsp local old_commit3=`git_show_head $testroot/repo`
1681 a347e6bb 2020-12-13 stsp got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1683 a347e6bb 2020-12-13 stsp if [ "$ret" != "0" ]; then
1684 a347e6bb 2020-12-13 stsp test_done "$testroot" "$ret"
1688 a347e6bb 2020-12-13 stsp cat > $testroot/editor.sh <<EOF
1690 c206b220 2021-10-09 thomas SOPTS='-i ""'
1691 c206b220 2021-10-09 thomas [ "\$OSTYPE" = "linux-gnu" ] && SOPTS="-i"
1692 c206b220 2021-10-09 thomas sed "\$SOPTS" -e 'd' "\$1"
1694 a347e6bb 2020-12-13 stsp chmod +x $testroot/editor.sh
1696 a347e6bb 2020-12-13 stsp (cd $testroot/wt && env EDITOR="$testroot/editor.sh" \
1697 a347e6bb 2020-12-13 stsp VISUAL="$testroot/editor.sh" got histedit -f > $testroot/stdout)
1699 a347e6bb 2020-12-13 stsp local new_commit1=`git_show_head $testroot/repo`
1701 a347e6bb 2020-12-13 stsp local short_old_commit1=`trim_obj_id 28 $old_commit1`
1702 a347e6bb 2020-12-13 stsp local very_short_old_commit1=`trim_obj_id 29 $old_commit1`
1703 a347e6bb 2020-12-13 stsp local short_old_commit2=`trim_obj_id 28 $old_commit2`
1704 a347e6bb 2020-12-13 stsp local short_old_commit3=`trim_obj_id 28 $old_commit3`
1705 a347e6bb 2020-12-13 stsp local short_new_commit1=`trim_obj_id 28 $new_commit1`
1706 a347e6bb 2020-12-13 stsp local short_new_commit2=`trim_obj_id 28 $new_commit2`
1708 a347e6bb 2020-12-13 stsp echo "G alpha" > $testroot/stdout.expected
1709 a347e6bb 2020-12-13 stsp echo "D beta" >> $testroot/stdout.expected
1710 a347e6bb 2020-12-13 stsp echo "A epsilon/new" >> $testroot/stdout.expected
1711 a347e6bb 2020-12-13 stsp echo "$short_old_commit1 -> fold commit: committing changes" \
1712 a347e6bb 2020-12-13 stsp >> $testroot/stdout.expected
1713 a347e6bb 2020-12-13 stsp echo "G epsilon/zeta" >> $testroot/stdout.expected
1714 a347e6bb 2020-12-13 stsp echo -n "$short_old_commit2 -> " >> $testroot/stdout.expected
1715 a347e6bb 2020-12-13 stsp echo "fold commit: committing to zeta on master" \
1716 a347e6bb 2020-12-13 stsp >> $testroot/stdout.expected
1717 a347e6bb 2020-12-13 stsp echo "G gamma/delta" >> $testroot/stdout.expected
1718 a347e6bb 2020-12-13 stsp echo -n "$short_old_commit3 -> $short_new_commit1: " \
1719 a347e6bb 2020-12-13 stsp >> $testroot/stdout.expected
1720 a347e6bb 2020-12-13 stsp echo "# log message of folded commit $very_short_old_commit1" \
1721 a347e6bb 2020-12-13 stsp >> $testroot/stdout.expected
1722 a347e6bb 2020-12-13 stsp echo "Switching work tree to refs/heads/master" \
1723 a347e6bb 2020-12-13 stsp >> $testroot/stdout.expected
1725 a347e6bb 2020-12-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1727 a347e6bb 2020-12-13 stsp if [ "$ret" != "0" ]; then
1728 a347e6bb 2020-12-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1729 a347e6bb 2020-12-13 stsp test_done "$testroot" "$ret"
1733 a347e6bb 2020-12-13 stsp echo "modified alpha on master" > $testroot/content.expected
1734 a347e6bb 2020-12-13 stsp cat $testroot/wt/alpha > $testroot/content
1735 a347e6bb 2020-12-13 stsp cmp -s $testroot/content.expected $testroot/content
1737 a347e6bb 2020-12-13 stsp if [ "$ret" != "0" ]; then
1738 a347e6bb 2020-12-13 stsp diff -u $testroot/content.expected $testroot/content
1739 a347e6bb 2020-12-13 stsp test_done "$testroot" "$ret"
1743 a347e6bb 2020-12-13 stsp if [ -e $testroot/wt/beta ]; then
1744 a347e6bb 2020-12-13 stsp echo "removed file beta still exists on disk" >&2
1745 a347e6bb 2020-12-13 stsp test_done "$testroot" "1"
1749 a347e6bb 2020-12-13 stsp echo "new file on master" > $testroot/content.expected
1750 a347e6bb 2020-12-13 stsp cat $testroot/wt/epsilon/new > $testroot/content
1751 a347e6bb 2020-12-13 stsp cmp -s $testroot/content.expected $testroot/content
1753 a347e6bb 2020-12-13 stsp if [ "$ret" != "0" ]; then
1754 a347e6bb 2020-12-13 stsp diff -u $testroot/content.expected $testroot/content
1755 a347e6bb 2020-12-13 stsp test_done "$testroot" "$ret"
1759 a347e6bb 2020-12-13 stsp (cd $testroot/wt && got status > $testroot/stdout)
1761 a347e6bb 2020-12-13 stsp echo -n > $testroot/stdout.expected
1762 a347e6bb 2020-12-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1764 a347e6bb 2020-12-13 stsp if [ "$ret" != "0" ]; then
1765 a347e6bb 2020-12-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1766 a347e6bb 2020-12-13 stsp test_done "$testroot" "$ret"
1770 a347e6bb 2020-12-13 stsp (cd $testroot/wt && got log | grep ^commit > $testroot/stdout)
1771 a347e6bb 2020-12-13 stsp echo "commit $new_commit1 (master)" > $testroot/stdout.expected
1772 c50a7455 2021-10-04 thomas echo "commit $orig_commit" >> $testroot/stdout.expected
1773 c50a7455 2021-10-04 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1774 c50a7455 2021-10-04 thomas ret="$?"
1775 c50a7455 2021-10-04 thomas if [ "$ret" != "0" ]; then
1776 c50a7455 2021-10-04 thomas diff -u $testroot/stdout.expected $testroot/stdout
1778 c50a7455 2021-10-04 thomas test_done "$testroot" "$ret"
1781 c50a7455 2021-10-04 thomas test_histedit_edit_only() {
1782 c50a7455 2021-10-04 thomas local testroot=`test_init histedit_edit_only`
1784 c50a7455 2021-10-04 thomas local orig_commit=`git_show_head $testroot/repo`
1786 c50a7455 2021-10-04 thomas echo "modified alpha on master" > $testroot/repo/alpha
1787 c50a7455 2021-10-04 thomas (cd $testroot/repo && git rm -q beta)
1788 c50a7455 2021-10-04 thomas echo "new file on master" > $testroot/repo/epsilon/new
1789 c50a7455 2021-10-04 thomas (cd $testroot/repo && git add epsilon/new)
1790 c50a7455 2021-10-04 thomas git_commit $testroot/repo -m "committing changes"
1791 c50a7455 2021-10-04 thomas local old_commit1=`git_show_head $testroot/repo`
1793 c50a7455 2021-10-04 thomas echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1794 c50a7455 2021-10-04 thomas git_commit $testroot/repo -m "committing to zeta on master"
1795 c50a7455 2021-10-04 thomas local old_commit2=`git_show_head $testroot/repo`
1797 c50a7455 2021-10-04 thomas got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
1798 c50a7455 2021-10-04 thomas ret="$?"
1799 c50a7455 2021-10-04 thomas if [ "$ret" != "0" ]; then
1800 c50a7455 2021-10-04 thomas test_done "$testroot" "$ret"
1801 c50a7455 2021-10-04 thomas return 1
1804 c50a7455 2021-10-04 thomas (cd $testroot/wt && got histedit -e > $testroot/stdout)
1806 c50a7455 2021-10-04 thomas local short_old_commit1=`trim_obj_id 28 $old_commit1`
1807 c50a7455 2021-10-04 thomas local short_old_commit2=`trim_obj_id 28 $old_commit2`
1809 c50a7455 2021-10-04 thomas echo "G alpha" > $testroot/stdout.expected
1810 c50a7455 2021-10-04 thomas echo "D beta" >> $testroot/stdout.expected
1811 c50a7455 2021-10-04 thomas echo "A epsilon/new" >> $testroot/stdout.expected
1812 c50a7455 2021-10-04 thomas echo "Stopping histedit for amending commit $old_commit1" \
1813 c50a7455 2021-10-04 thomas >> $testroot/stdout.expected
1814 c50a7455 2021-10-04 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1815 c50a7455 2021-10-04 thomas ret="$?"
1816 c50a7455 2021-10-04 thomas if [ "$ret" != "0" ]; then
1817 c50a7455 2021-10-04 thomas diff -u $testroot/stdout.expected $testroot/stdout
1818 c50a7455 2021-10-04 thomas test_done "$testroot" "$ret"
1819 c50a7455 2021-10-04 thomas return 1
1822 c50a7455 2021-10-04 thomas echo "edited modified alpha on master" > $testroot/wt/alpha
1824 c50a7455 2021-10-04 thomas cat > $testroot/editor.sh <<EOF
1825 c50a7455 2021-10-04 thomas #!/bin/sh
1826 c50a7455 2021-10-04 thomas sed -i 's/.*/committing edited changes 1/' "\$1"
1828 c50a7455 2021-10-04 thomas chmod +x $testroot/editor.sh
1830 c50a7455 2021-10-04 thomas (cd $testroot/wt && env EDITOR="$testroot/editor.sh" \
1831 c50a7455 2021-10-04 thomas VISUAL="$testroot/editor.sh" got histedit -c > $testroot/stdout)
1833 c50a7455 2021-10-04 thomas local new_commit1=$(cd $testroot/wt && got info | \
1834 c50a7455 2021-10-04 thomas grep '^work tree base commit: ' | cut -d: -f2 | tr -d ' ')
1835 c50a7455 2021-10-04 thomas local short_new_commit1=`trim_obj_id 28 $new_commit1`
1837 c50a7455 2021-10-04 thomas echo -n "$short_old_commit1 -> $short_new_commit1: " \
1838 c50a7455 2021-10-04 thomas > $testroot/stdout.expected
1839 c50a7455 2021-10-04 thomas echo "committing edited changes 1" >> $testroot/stdout.expected
1840 c50a7455 2021-10-04 thomas echo "G epsilon/zeta" >> $testroot/stdout.expected
1841 c50a7455 2021-10-04 thomas echo "Stopping histedit for amending commit $old_commit2" \
1842 c50a7455 2021-10-04 thomas >> $testroot/stdout.expected
1843 c50a7455 2021-10-04 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1844 c50a7455 2021-10-04 thomas ret="$?"
1845 c50a7455 2021-10-04 thomas if [ "$ret" != "0" ]; then
1846 c50a7455 2021-10-04 thomas diff -u $testroot/stdout.expected $testroot/stdout
1847 c50a7455 2021-10-04 thomas test_done "$testroot" "$ret"
1848 c50a7455 2021-10-04 thomas return 1
1851 c50a7455 2021-10-04 thomas echo "edited zeta on master" > $testroot/wt/epsilon/zeta
1853 c50a7455 2021-10-04 thomas cat > $testroot/editor.sh <<EOF
1854 c50a7455 2021-10-04 thomas #!/bin/sh
1855 c50a7455 2021-10-04 thomas sed -i 's/.*/committing edited changes 2/' "\$1"
1857 c50a7455 2021-10-04 thomas chmod +x $testroot/editor.sh
1859 c50a7455 2021-10-04 thomas (cd $testroot/wt && env EDITOR="$testroot/editor.sh" \
1860 c50a7455 2021-10-04 thomas VISUAL="$testroot/editor.sh" got histedit -c > $testroot/stdout)
1862 c50a7455 2021-10-04 thomas local new_commit2=`git_show_head $testroot/repo`
1863 c50a7455 2021-10-04 thomas local short_new_commit2=`trim_obj_id 28 $new_commit2`
1865 c50a7455 2021-10-04 thomas echo -n "$short_old_commit2 -> $short_new_commit2: " \
1866 c50a7455 2021-10-04 thomas > $testroot/stdout.expected
1867 c50a7455 2021-10-04 thomas echo "committing edited changes 2" >> $testroot/stdout.expected
1868 c50a7455 2021-10-04 thomas echo "Switching work tree to refs/heads/master" \
1869 c50a7455 2021-10-04 thomas >> $testroot/stdout.expected
1871 c50a7455 2021-10-04 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1872 c50a7455 2021-10-04 thomas ret="$?"
1873 c50a7455 2021-10-04 thomas if [ "$ret" != "0" ]; then
1874 c50a7455 2021-10-04 thomas diff -u $testroot/stdout.expected $testroot/stdout
1875 c50a7455 2021-10-04 thomas test_done "$testroot" "$ret"
1876 c50a7455 2021-10-04 thomas return 1
1879 c50a7455 2021-10-04 thomas echo "edited modified alpha on master" > $testroot/content.expected
1880 c50a7455 2021-10-04 thomas cat $testroot/wt/alpha > $testroot/content
1881 c50a7455 2021-10-04 thomas cmp -s $testroot/content.expected $testroot/content
1882 c50a7455 2021-10-04 thomas ret="$?"
1883 c50a7455 2021-10-04 thomas if [ "$ret" != "0" ]; then
1884 c50a7455 2021-10-04 thomas diff -u $testroot/content.expected $testroot/content
1885 c50a7455 2021-10-04 thomas test_done "$testroot" "$ret"
1886 c50a7455 2021-10-04 thomas return 1
1889 c50a7455 2021-10-04 thomas if [ -e $testroot/wt/beta ]; then
1890 c50a7455 2021-10-04 thomas echo "removed file beta still exists on disk" >&2
1891 c50a7455 2021-10-04 thomas test_done "$testroot" "1"
1892 c50a7455 2021-10-04 thomas return 1
1895 c50a7455 2021-10-04 thomas echo "new file on master" > $testroot/content.expected
1896 c50a7455 2021-10-04 thomas cat $testroot/wt/epsilon/new > $testroot/content
1897 c50a7455 2021-10-04 thomas cmp -s $testroot/content.expected $testroot/content
1898 c50a7455 2021-10-04 thomas ret="$?"
1899 c50a7455 2021-10-04 thomas if [ "$ret" != "0" ]; then
1900 c50a7455 2021-10-04 thomas diff -u $testroot/content.expected $testroot/content
1901 c50a7455 2021-10-04 thomas test_done "$testroot" "$ret"
1902 c50a7455 2021-10-04 thomas return 1
1905 c50a7455 2021-10-04 thomas (cd $testroot/wt && got status > $testroot/stdout)
1907 c50a7455 2021-10-04 thomas echo -n > $testroot/stdout.expected
1908 c50a7455 2021-10-04 thomas cmp -s $testroot/stdout.expected $testroot/stdout
1909 c50a7455 2021-10-04 thomas ret="$?"
1910 c50a7455 2021-10-04 thomas if [ "$ret" != "0" ]; then
1911 c50a7455 2021-10-04 thomas diff -u $testroot/stdout.expected $testroot/stdout
1912 c50a7455 2021-10-04 thomas test_done "$testroot" "$ret"
1913 c50a7455 2021-10-04 thomas return 1
1916 c50a7455 2021-10-04 thomas (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1917 c50a7455 2021-10-04 thomas echo "commit $new_commit2 (master)" > $testroot/stdout.expected
1918 c50a7455 2021-10-04 thomas echo "commit $new_commit1" >> $testroot/stdout.expected
1919 a347e6bb 2020-12-13 stsp echo "commit $orig_commit" >> $testroot/stdout.expected
1920 a347e6bb 2020-12-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1922 a347e6bb 2020-12-13 stsp if [ "$ret" != "0" ]; then
1923 a347e6bb 2020-12-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
1925 a347e6bb 2020-12-13 stsp test_done "$testroot" "$ret"
1928 66eecf0d 2021-10-08 thomas test_histedit_prepend_line() {
1929 66eecf0d 2021-10-08 thomas local testroot=`test_init histedit_prepend_line`
1930 66eecf0d 2021-10-08 thomas local orig_commit=`git_show_head $testroot/repo`
1932 66eecf0d 2021-10-08 thomas got checkout $testroot/repo $testroot/wt > /dev/null
1934 66eecf0d 2021-10-08 thomas ed "$testroot/wt/alpha" <<EOF >/dev/null 2>&1
1936 66eecf0d 2021-10-08 thomas first line
1941 66eecf0d 2021-10-08 thomas cp $testroot/wt/alpha $testroot/content.expected
1943 66eecf0d 2021-10-08 thomas (cd $testroot/wt/ && got commit -m 'modified alpha on master' \
1944 66eecf0d 2021-10-08 thomas alpha > /dev/null)
1945 66eecf0d 2021-10-08 thomas ret="$?"
1946 66eecf0d 2021-10-08 thomas if [ "$?" != 0 ]; then
1947 66eecf0d 2021-10-08 thomas echo "got commit failed unexpectedly" >&2
1948 66eecf0d 2021-10-08 thomas test_done "$testroot" "$ret"
1949 66eecf0d 2021-10-08 thomas return 1
1952 66eecf0d 2021-10-08 thomas local top_commit=`git_show_head $testroot/repo`
1953 66eecf0d 2021-10-08 thomas echo "pick $top_commit" > "$testroot/histedit-script"
1955 66eecf0d 2021-10-08 thomas (cd $testroot/wt/ && got update -c $orig_commit > /dev/null)
1956 66eecf0d 2021-10-08 thomas ret="$?"
1957 66eecf0d 2021-10-08 thomas if [ "$?" != 0 ]; then
1958 66eecf0d 2021-10-08 thomas echo "got update failed unexpectedly" >&2
1959 66eecf0d 2021-10-08 thomas test_done "$testroot" "$ret"
1960 66eecf0d 2021-10-08 thomas return 1
1963 66eecf0d 2021-10-08 thomas (cd $testroot/wt && got histedit -F "$testroot/histedit-script" \
1964 66eecf0d 2021-10-08 thomas > /dev/null)
1965 66eecf0d 2021-10-08 thomas ret="$?"
1966 66eecf0d 2021-10-08 thomas if [ "$?" != 0 ]; then
1967 66eecf0d 2021-10-08 thomas echo "got histedit failed unexpectedly" >&2
1968 66eecf0d 2021-10-08 thomas test_done "$testroot" "$ret"
1969 66eecf0d 2021-10-08 thomas return 1
1972 66eecf0d 2021-10-08 thomas cp $testroot/wt/alpha $testroot/content
1973 66eecf0d 2021-10-08 thomas cmp -s $testroot/content.expected $testroot/content
1974 66eecf0d 2021-10-08 thomas ret="$?"
1975 66eecf0d 2021-10-08 thomas if [ "$ret" != "0" ]; then
1976 66eecf0d 2021-10-08 thomas diff -u $testroot/content.expected $testroot/content
1977 66eecf0d 2021-10-08 thomas test_done "$testroot" "$ret"
1978 66eecf0d 2021-10-08 thomas return 1
1981 66eecf0d 2021-10-08 thomas test_done "$testroot" $ret
1984 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1985 0ebf8283 2019-07-24 stsp run_test test_histedit_no_op
1986 0ebf8283 2019-07-24 stsp run_test test_histedit_swap
1987 0ebf8283 2019-07-24 stsp run_test test_histedit_drop
1988 0ebf8283 2019-07-24 stsp run_test test_histedit_fold
1989 0ebf8283 2019-07-24 stsp run_test test_histedit_edit
1990 0ebf8283 2019-07-24 stsp run_test test_histedit_fold_last_commit
1991 0ebf8283 2019-07-24 stsp run_test test_histedit_missing_commit
1992 0ebf8283 2019-07-24 stsp run_test test_histedit_abort
1993 a4027091 2019-07-25 stsp run_test test_histedit_path_prefix_drop
1994 b2c50a0a 2019-07-25 stsp run_test test_histedit_path_prefix_edit
1995 c7d20a3f 2019-07-30 stsp run_test test_histedit_outside_refs_heads
1996 0def28b1 2019-08-17 stsp run_test test_histedit_fold_last_commit_swap
1997 de05890f 2020-03-05 stsp run_test test_histedit_split_commit
1998 5b87815e 2020-03-05 stsp run_test test_histedit_duplicate_commit_in_script
1999 ecfff807 2020-09-23 stsp run_test test_histedit_fold_add_delete
2000 239f5c5a 2020-12-13 stsp run_test test_histedit_fold_only
2001 a347e6bb 2020-12-13 stsp run_test test_histedit_fold_only_empty_logmsg
2002 c50a7455 2021-10-04 thomas run_test test_histedit_edit_only
2003 66eecf0d 2021-10-08 thomas run_test test_histedit_prepend_line