commit - 40f2f72b99bb70a7be40eada71e5acd8a77ab58d
commit + ac3cdf31e06d51b4966449da12216d3614e10576
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 - 9ab729c90b157cfb194f331126a700a54e6c6344
blob + fe9c943bc19d1b0b6905788633041f88ae69282b
--- regress/cmdline/diff.sh
+++ regress/cmdline/diff.sh
return 1
fi
- sed -i '' -e 's/2/22/' $testroot/repo/numbers
- sed -i '' -e '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 '' -e 's/2/77/' $testroot/wt/numbers
- sed -i '' -e '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 - 2544b3c1d2ee0467ce9294033382d12ae4ced52a
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
-SOPTS='-i ""'
-[ "\$OSTYPE" = "linux-gnu" ] && SOPTS="-i"
-sed "\$SOPTS" -e '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
-SOPTS='-i ""'
-[ "\$OSTYPE" = "linux-gnu" ] && SOPTS="-i"
-sed "\$SOPTS" -e '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 - e70257974f118426479de4291f7224d953e09e82
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 - 2da7971145c62f07fd34f488c546f17a4380fd12
blob + bb9bf5f2cfb2999593b2a87a563f1f0272822950
--- 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 - c3dfaf5a6c26ee597b31705a4a382d777de7d6a2
blob + 282f6198ef06d3c01364dc6a50d274ad0a31821e
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
return 1
fi
- sed -i '' -e '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 '' -e '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 '' -e '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 '' -e '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 '' -e '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 '' -e '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 - ebf6d3cd41806a0cb17cdc6f75d6528777cf8631
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 - 0d8ff6767ff1c9ee4ac80bced71b0fd2ad8d1a39
blob + 4aa5a095404e1e99181588149852bfe3df333a9c
--- regress/cmdline/update.sh
+++ regress/cmdline/update.sh
echo "modified alpha" > $testroot/repo/alpha
echo "modified beta" > $testroot/repo/beta
- sed -i '' -e '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 '' -e '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