commit - 57993930913522d8e81509ef26d8e0a26d571815
commit + 885e96dfba200f362ddd1d9795740251bcb6e39b
blob - 719bac3298df1e16197cba688737ead5ea2508cd
blob + 2c121a047d8340ad0c16b6b008bc82fe3d7277eb
--- regress/cmdline/blame.sh
+++ regress/cmdline/blame.sh
local short_commit1=`trim_obj_id 32 $commit1`
local author_time=`git_show_author_time $testroot/repo`
- sed -i -e '/^[345]$/d' $testroot/wt/alpha
+ ed -s $testroot/wt/alpha <<-\EOF
+ g/^[345]$/d
+ w
+ EOF
(cd $testroot/wt && got commit -m "change 2" > /dev/null)
local commit2=`git_show_head $testroot/repo`
local short_commit2=`trim_obj_id 32 $commit2`
local short_commit1=`trim_obj_id 32 $commit1`
local author_time=`git_show_author_time $testroot/repo`
- sed -i -e '/^8$/d' $testroot/wt/alpha
+ ed -s $testroot/wt/alpha <<-\EOF
+ g/^8$/d
+ w
+ EOF
(cd $testroot/wt && got commit -m "change 2" > /dev/null)
local commit2=`git_show_head $testroot/repo`
local short_commit2=`trim_obj_id 32 $commit2`
blob - b57e9531206c81f063628b12b4a2b476cc3e6135
blob + 26a31c050dfc034e8c024f4e945dafbc2d72cf28
--- regress/cmdline/commit.sh
+++ regress/cmdline/commit.sh
cat > $testroot/editor.sh <<EOF
#!/bin/sh
-sed -i 's/# l/l/' "\$1"
+ed -s "\$1" <<-EOF
+ ,s/# l/l/
+ w
+ EOF
EOF
chmod +x $testroot/editor.sh
blob - cfcbb7402cba3671e0519ad680092846ffd36a21
blob + fe9c943bc19d1b0b6905788633041f88ae69282b
--- regress/cmdline/diff.sh
+++ regress/cmdline/diff.sh
return 1
fi
- sed -i 's/2/22/' $testroot/repo/numbers
- sed -i 's/8/33/' $testroot/repo/numbers
+ ed -s $testroot/repo/numbers <<-\EOF
+ ,s/2/22/
+ ,s/8/33/
+ w
+ EOF
git_commit $testroot/repo -m "modified line 2"
local head_rev=`git_show_head $testroot/repo`
# modify lines 2 and 8 in conflicting ways
- sed -i 's/2/77/' $testroot/wt/numbers
- sed -i 's/8/88/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/2/77/
+ ,s/8/88/
+ w
+ EOF
echo "C numbers" > $testroot/stdout.expected
echo -n "Updated to refs/heads/master: $head_rev" \
blob - 737b0cb81e316d7acd423ca57c68f090d5f33d9f
blob + 79f558cff6a61109fdd1089a30e941fcf382b49d
--- regress/cmdline/fetch.sh
+++ regress/cmdline/fetch.sh
fi
# remove default branch information from got.conf
- sed -i -e "/branch {/d" $testroot/repo-clone/got.conf
+ ed -s $testroot/repo-clone/got.conf <<-EOF
+ g/branch {/d
+ w
+ EOF
# make another change on 'foo' and fetch it without got.conf
(cd $testroot/repo && git checkout -q foo)
# from repo: fetch got.conf branch which doesn't exist, so fallback
# to repo HEAD "boo"
# change default branch in got.conf from "master" to "foo"
- sed -i "s/master/foo/" $testroot/repo-clone/got.conf
+ ed -s $testroot/repo-clone/got.conf <<-EOF
+ ,s/master/foo/
+ w
+ EOF
got fetch -q -r $testroot/repo-clone > $testroot/stdout
ret=$?
# from wt: fetch got.conf "master", wt "boo", and the repo's new HEAD
# "hoo" as it no longer matches our remote HEAD symref target "master"
- sed -i "s/foo/master/" $testroot/repo-clone/got.conf
+ ed -s $testroot/repo-clone/got.conf <<-EOF
+ ,s/foo/master/
+ w
+ EOF
echo "modified delta on master" > $testroot/repo/gamma/delta
git_commit $testroot/repo -m "modified delta on master"
local commit_id5=`git_show_head $testroot/repo`
blob - b7f9e922f4dd32f8ae9e742d6701a371efa9fc58
blob + 7f41dbf2a6228ff4edc4bb8fd6d844625b1b6dc5
--- regress/cmdline/histedit.sh
+++ regress/cmdline/histedit.sh
got diff -r $testroot/repo $orig_commit $new_commit2 \
> $testroot/diff
- sed -i -e "s/$old_commit2/$new_commit2/" $testroot/diff.expected
+ ed -s $testroot/diff.expected <<-EOF
+ ,s/$old_commit2/$new_commit2/
+ w
+ EOF
cmp -s $testroot/diff.expected $testroot/diff
ret=$?
if [ $ret -ne 0 ]; then
got diff -r $testroot/repo $orig_commit $new_commit1 \
> $testroot/diff
- sed -i -e "s/$old_commit2/$new_commit1/" $testroot/diff.expected
+ ed -s $testroot/diff.expected <<-EOF
+ ,s/$old_commit2/$new_commit1/
+ w
+ EOF
cmp -s $testroot/diff.expected $testroot/diff
ret=$?
if [ $ret -ne 0 ]; then
got diff -r $testroot/repo $orig_commit $new_commit2 \
> $testroot/diff
- sed -i -e "s/$old_commit1/$orig_commit/" $testroot/diff.expected
- sed -i -e "s/$old_commit2/$new_commit2/" $testroot/diff.expected
+ ed -s $testroot/diff.expected <<-EOF
+ ,s/$old_commit1/$orig_commit/
+ ,s/$old_commit2/$new_commit2/
+ w
+ EOF
cmp -s $testroot/diff.expected $testroot/diff
ret=$?
if [ $ret -ne 0 ]; then
got diff -r $testroot/repo $orig_commit $new_commit1 \
> $testroot/diff
- sed -i -e "s/$old_commit1/$new_commit1/" $testroot/diff.expected
+ ed -s $testroot/diff.expected <<-EOF
+ ,s/$old_commit1/$new_commit1/
+ w
+ EOF
cmp -s $testroot/diff.expected $testroot/diff
ret=$?
if [ $ret -ne 0 ]; then
cat > $testroot/editor.sh <<EOF
#!/bin/sh
-sed -i 's/.*/committing folded changes/' "\$1"
+ed -s "\$1" <<-EOF
+ ,s/.*/committing folded changes/
+ w
+ EOF
EOF
chmod +x $testroot/editor.sh
cat > $testroot/editor.sh <<EOF
#!/bin/sh
-sed -i 'd' "\$1"
+ed -s "\$1" <<-EOF
+ ,d
+ w
+ EOF
EOF
chmod +x $testroot/editor.sh
cat > $testroot/editor.sh <<EOF
#!/bin/sh
-sed -i 's/.*/committing edited changes 1/' "\$1"
+ed -s "\$1" <<-EOF
+ ,s/.*/committing edited changes 1/
+ w
+ EOF
EOF
chmod +x $testroot/editor.sh
cat > $testroot/editor.sh <<EOF
#!/bin/sh
-sed -i 's/.*/committing edited changes 2/' "\$1"
+ed -s "\$1" <<-EOF
+ ,s/.*/committing edited changes 2/
+ w
+ EOF
EOF
chmod +x $testroot/editor.sh
cat > $testroot/editor.sh <<EOF
#!/bin/sh
-sed -i 's/ x bit / executable bit /' "\$1"
+ed -s "\$1" <<-EOF
+ ,s/ x bit / executable bit /
+ w
+ EOF
EOF
chmod +x $testroot/editor.sh
blob - fceaf181cd74c8b1810cfe97234af037bb77561c
blob + 6a4b676aff1b3de6b3384590c038eb5b5045981b
--- regress/cmdline/rebase.sh
+++ regress/cmdline/rebase.sh
(cd $testroot/wt && got log -c newbranch -l2 | grep -v ^date: \
> $testroot/log)
- sed -i -e "s/$orig_commit1/$new_commit1/" $testroot/log.expected
- sed -i -e "s/$orig_commit2/$new_commit2/" $testroot/log.expected
+ ed -s $testroot/log.expected <<-EOF
+ ,s/$orig_commit1/$new_commit1/
+ ,s/$orig_commit2/$new_commit2/
+ w
+ EOF
cmp -s $testroot/log.expected $testroot/log
ret=$?
if [ $ret -ne 0 ]; then
blob - b568329b09e4e5ae44e43459bc4b32b4d3050b36
blob + 3ae6b968f8817e9efb7b1abb879557fe19622e08
--- regress/cmdline/revert.sh
+++ regress/cmdline/revert.sh
return 1
fi
- sed -i -e 's/^2$/a/' $testroot/wt/numbers
- sed -i -e 's/^7$/b/' $testroot/wt/numbers
- sed -i -e 's/^16$/c/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/^2$/a/
+ ,s/^7$/b/
+ ,s/^16$/c/
+ w
+ EOF
(cd $testroot/wt && got diff > $testroot/numbers.diff)
fi
# put first hunk back
- sed -i -e 's/^2$/a/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/^2$/a/
+ w
+ EOF
# revert middle hunk
printf "n\ny\nn\n" > $testroot/patchscript
# Ensure file size is changed. Avoids race condition causing test
# failures where 'got revert' does not see changes to revert if
# timestamps and size in stat info remain unchanged.
- sed -i -e 's/^2$/aa/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/^2$/aa/
+ w
+ EOF
# revert change with -p
printf "y\n" > $testroot/patchscript
blob - 01dd0b976f6f7b5d840e72398cadf29728591229
blob + 8c960baef8925da8232651df8d17bfdb3d9dc2cd
--- regress/cmdline/stage.sh
+++ regress/cmdline/stage.sh
return 1
fi
- sed -i -e 's/^2$/a/' $testroot/wt/numbers
- sed -i -e 's/^7$/b/' $testroot/wt/numbers
- sed -i -e 's/^16$/c/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/^2$/a/
+ ,s/^7$/b/
+ ,s/^16$/c/
+ w
+ EOF
# don't stage any hunks
printf "n\nn\nn\n" > $testroot/patchscript
return 1
fi
- sed -i -e 's/^2$/a/' $testroot/wt/numbers
- sed -i -e 's/^7$/b/' $testroot/wt/numbers
- sed -i -e 's/^16$/c/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/^2$/a/
+ ,s/^7$/b/
+ ,s/^16$/c/
+ w
+ EOF
# stage middle hunk
printf "n\ny\nn\n" > $testroot/patchscript
return 1
fi
- sed -i -e 's/^2$/a/' $testroot/wt/numbers
- sed -i -e 's/^7$/b/' $testroot/wt/numbers
- sed -i -e 's/^16$/c/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/^2$/a/
+ ,s/^7$/b/
+ ,s/^16$/c/
+ w
+ EOF
(cd $testroot/wt && got rm zzz > /dev/null)
# stage first hunk and quit; and don't pass a path argument to
return 1
fi
- sed -i -e 's/^2$/a/' $testroot/wt/numbers
- sed -i -e 's/^7$/b/' $testroot/wt/numbers
- sed -i -e 's/^16$/c/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/^2$/a/
+ ,s/^7$/b/
+ ,s/^16$/c/
+ w
+ EOF
# stage first hunk and then stop responding; got should error out
printf "y\n" > $testroot/patchscript
blob - 6098eb8ab154c97c655c6d305d0d01b1db1c71a7
blob + 282f6198ef06d3c01364dc6a50d274ad0a31821e
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
return 1
fi
- sed -i 's/2/22/' $testroot/repo/numbers
+ ed -s $testroot/repo/numbers <<-\EOF
+ ,s/2/22/
+ w
+ EOF
git_commit $testroot/repo -m "modified line 2"
# modify line 7; both changes should merge cleanly
- sed -i 's/7/77/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/7/77/
+ w
+ EOF
echo "G numbers" > $testroot/stdout.expected
echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
return 1
fi
- sed -i 's/2/22/' $testroot/repo/numbers
+ ed -s $testroot/repo/numbers <<-\EOF
+ ,s/2/22/
+ w
+ EOF
git_commit $testroot/repo -m "modified line 2"
# modify line 2 again; no local changes are left after merge
- sed -i 's/2/22/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/2/22/
+ w
+ EOF
echo "G numbers" > $testroot/stdout.expected
echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
return 1
fi
- sed -i 's/2/22/' $testroot/repo/numbers
+ ed -s $testroot/repo/numbers <<-\EOF
+ ,s/2/22/
+ w
+ EOF
git_commit $testroot/repo -m "modified line 2"
# modify line 2 in a conflicting way
- sed -i 's/2/77/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/2/77/
+ w
+ EOF
echo "C numbers" > $testroot/stdout.expected
echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
blob - 768bc40e938998a7e2da71aaab91d5477bcc2725
blob + f5ebd5bc9adac2a53e2651879adde02156aa7f10
--- regress/cmdline/unstage.sh
+++ regress/cmdline/unstage.sh
return 1
fi
- sed -i -e 's/^2$/a/' $testroot/wt/numbers
- sed -i -e 's/^7$/b/' $testroot/wt/numbers
- sed -i -e 's/^16$/c/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/^2$/a/
+ ,s/^7$/b/
+ ,s/^16$/c/
+ w
+ EOF
(cd $testroot/wt && got stage > /dev/null)
ret=$?
return 1
fi
- sed -i -e 's/^2$/a/' $testroot/wt/numbers
- sed -i -e 's/^7$/b/' $testroot/wt/numbers
- sed -i -e 's/^16$/c/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/^2$/a/
+ ,s/^7$/b/
+ ,s/^16$/c/
+ w
+ EOF
(cd $testroot/wt && got rm zzz > /dev/null)
(cd $testroot/wt && got stage > /dev/null)
blob - 0c032a1c4d45adc6a488c656983e61f0effc8e54
blob + 4aa5a095404e1e99181588149852bfe3df333a9c
--- regress/cmdline/update.sh
+++ regress/cmdline/update.sh
echo "modified alpha" > $testroot/repo/alpha
echo "modified beta" > $testroot/repo/beta
- sed -i 's/2/22/' $testroot/repo/numbers
+ ed -s $testroot/repo/numbers <<-\EOF
+ ,s/2/22/
+ w
+ EOF
git_commit $testroot/repo -m "modified 3 files"
echo "modified alpha, too" > $testroot/wt/alpha
touch $testroot/wt/beta
- sed -i 's/7/77/' $testroot/wt/numbers
+ ed -s $testroot/wt/numbers <<-\EOF
+ ,s/7/77/
+ w
+ EOF
echo "C alpha" > $testroot/stdout.expected
echo "U beta" >> $testroot/stdout.expected