Skip to content

Commit 3015fa5

Browse files
raalkmlgitster
authored andcommitted
Fix use of "perl -i" on Windows
The perldiag(1) has following to say about this: "Can't do inplace edit without backup" (F) You're on a system such as MS-DOS that gets confused if you try reading from a deleted (but still opened) file. You have to say -i.bak, or some such. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e2da671 commit 3015fa5

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

t/t5303-pack-corruption-resilience.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ test_expect_success \
9090
'create_new_pack &&
9191
git prune-packed &&
9292
chmod +w ${pack}.pack &&
93-
perl -i -pe "s/ base /abcdef/" ${pack}.pack &&
93+
perl -i.bak -pe "s/ base /abcdef/" ${pack}.pack &&
9494
test_must_fail git cat-file blob $blob_1 > /dev/null &&
9595
test_must_fail git cat-file blob $blob_2 > /dev/null &&
9696
test_must_fail git cat-file blob $blob_3 > /dev/null'
@@ -138,7 +138,7 @@ test_expect_success \
138138
'create_new_pack &&
139139
git prune-packed &&
140140
chmod +w ${pack}.pack &&
141-
perl -i -pe "s/ delta1 /abcdefgh/" ${pack}.pack &&
141+
perl -i.bak -pe "s/ delta1 /abcdefgh/" ${pack}.pack &&
142142
git cat-file blob $blob_1 > /dev/null &&
143143
test_must_fail git cat-file blob $blob_2 > /dev/null &&
144144
test_must_fail git cat-file blob $blob_3 > /dev/null'

t/t9106-git-svn-dcommit-clobber-series.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ test_expect_success '(supposedly) non-conflicting change from SVN' '
2020
test x"`sed -n -e 61p < file`" = x61 &&
2121
svn co "$svnrepo" tmp &&
2222
cd tmp &&
23-
perl -i -p -e "s/^58$/5588/" file &&
24-
perl -i -p -e "s/^61$/6611/" file &&
23+
perl -i.bak -p -e "s/^58$/5588/" file &&
24+
perl -i.bak -p -e "s/^61$/6611/" file &&
2525
poke file &&
2626
test x"`sed -n -e 58p < file`" = x5588 &&
2727
test x"`sed -n -e 61p < file`" = x6611 &&
@@ -40,8 +40,8 @@ test_expect_success 'some unrelated changes to git' "
4040
test_expect_success 'change file but in unrelated area' "
4141
test x\"\`sed -n -e 4p < file\`\" = x4 &&
4242
test x\"\`sed -n -e 7p < file\`\" = x7 &&
43-
perl -i -p -e 's/^4\$/4444/' file &&
44-
perl -i -p -e 's/^7\$/7777/' file &&
43+
perl -i.bak -p -e 's/^4\$/4444/' file &&
44+
perl -i.bak -p -e 's/^7\$/7777/' file &&
4545
test x\"\`sed -n -e 4p < file\`\" = x4444 &&
4646
test x\"\`sed -n -e 7p < file\`\" = x7777 &&
4747
git commit -m '4 => 4444, 7 => 7777' file &&

templates/hooks--prepare-commit-msg.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323
case "$2,$3" in
2424
merge,)
25-
perl -i -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
25+
perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
2626

2727
# ,|template,)
28-
# perl -i -pe '
28+
# perl -i.bak -pe '
2929
# print "\n" . `git diff --cached --name-status -r`
3030
# if /^#/ && $first++ == 0' "$1" ;;
3131

0 commit comments

Comments
 (0)