t9402: sed -i is not portable
On some systems sed allows the usage of e.g. sed -i -e "s/line1/line2/" afile to edit the file "in place". Other systems don't allow that: one observed behaviour is that sed -i -e "s/line1/line2/" afile creates a backup file called afile-e, which breaks the test. As sed -i is not part of POSIX, avoid it. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Torsten Bögershausen committed
Dec 8, 2012 at 22:33 UTC
76095f6d609a465840f62dd601a1ad9f90c75330
1 file changed
+6
-3
t/t9402-git-cvsserver-refs.sh
+6
-3
@@ -155,7 +155,8 @@ test_expect_success 'cvs co b1 [cvswork3]' '
155
156
test_expect_success 'edit cvswork3 and save diff' '
157
( cd cvswork3 &&
158
- sed -i -e "s/line1/line1 - data/" adir/afile &&
158
+ sed -e "s/line1/line1 - data/" adir/afile >adir/afileNEW &&
159
+ mv -f adir/afileNEW adir/afile &&
160
echo "afile5" > adir/afile5 &&
161
rm t2 &&
162
cvs -f add adir/afile5 &&
@@ -168,7 +169,8 @@ test_expect_success 'setup v1.2 on b1' '
169
git checkout b1 &&
170
echo "new v1.2" > t3 &&
171
rm t2 &&
171
- sed -i -e "s/line3/line3 - more data/" adir/afile &&
172
+ sed -e "s/line3/line3 - more data/" adir/afile >adir/afileNEW &&
173
+ mv -f adir/afileNEW adir/afile &&
174
rm adir/a2file &&
175
echo "a3file" >> adir/a3file &&
176
echo "bfile line 3" >> adir/bdir/bfile &&
@@ -300,7 +302,8 @@ test_expect_success 'root dir rm file [cvswork2]' '
302
303
test_expect_success 'subdir edit/add/rm files [cvswork2' '
304
( cd cvswork2 &&
303
- sed -i -e "s/line 1/line 1 (v2)/" adir/bdir/bfile &&
305
+ sed -e "s/line 1/line 1 (v2)/" adir/bdir/bfile >adir/bdir/bfileNEW &&
306
+ mv -f adir/bdir/bfileNEW adir/bdir/bfile &&
307
rm adir/bdir/b2file &&
308
cd adir &&
309
cvs -f rm bdir/b2file &&