Skip to content

Commit

Permalink
Merge branch 'bw/solaris-sed-tr-test-portability'
Browse files Browse the repository at this point in the history
* bw/solaris-sed-tr-test-portability:
  t4015: simplify sed command that is not even seen by sed
  Avoid difference in tr semantics between System V and BSD
  Change sed i\ usage to something Solaris' sed can handle
  • Loading branch information
Junio C Hamano committed Nov 4, 2013
2 parents ea06592 + 05e9d90 commit 944adac
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
30 changes: 18 additions & 12 deletions t/t0008-ignores.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ test_stderr () {
test_cmp "$HOME/expected-stderr" "$HOME/stderr"
}

broken_c_unquote () {
"$PERL_PATH" -pe 's/^"//; s/\\//; s/"$//; tr/\n/\0/' "$@"
}

broken_c_unquote_verbose () {
"$PERL_PATH" -pe 's/ "/ /; s/\\//; s/"$//; tr/:\t\n/\0/' "$@"
}

stderr_contains () {
regexp="$1"
if grep "$regexp" "$HOME/stderr"
Expand Down Expand Up @@ -606,12 +614,11 @@ cat <<-EOF >expected-verbose
$global_excludes:2:!globaltwo b/globaltwo
EOF

sed -e 's/^"//' -e 's/\\//' -e 's/"$//' stdin | \
tr "\n" "\0" >stdin0
sed -e 's/^"//' -e 's/\\//' -e 's/"$//' expected-default | \
tr "\n" "\0" >expected-default0
sed -e 's/ "/ /' -e 's/\\//' -e 's/"$//' expected-verbose | \
tr ":\t\n" "\0" >expected-verbose0
broken_c_unquote stdin >stdin0

broken_c_unquote expected-default >expected-default0

broken_c_unquote_verbose expected-verbose >expected-verbose0

test_expect_success '--stdin' '
expect_from_stdin <expected-default &&
Expand Down Expand Up @@ -692,12 +699,11 @@ EOF
grep -v '^:: ' expected-all >expected-verbose
sed -e 's/.* //' expected-verbose >expected-default

sed -e 's/^"//' -e 's/\\//' -e 's/"$//' stdin | \
tr "\n" "\0" >stdin0
sed -e 's/^"//' -e 's/\\//' -e 's/"$//' expected-default | \
tr "\n" "\0" >expected-default0
sed -e 's/ "/ /' -e 's/\\//' -e 's/"$//' expected-verbose | \
tr ":\t\n" "\0" >expected-verbose0
broken_c_unquote stdin >stdin0

broken_c_unquote expected-default >expected-default0

broken_c_unquote_verbose expected-verbose >expected-verbose0

test_expect_success '--stdin from subdirectory' '
expect_from_stdin <expected-default &&
Expand Down
5 changes: 3 additions & 2 deletions t/t4015-diff-whitespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ test_expect_success 'another test, with --ignore-space-at-eol' 'test_cmp expect
test_expect_success 'ignore-blank-lines: only new lines' '
test_seq 5 >x &&
git update-index x &&
test_seq 5 | sed "/3/i \\
test_seq 5 | sed "/3/i\\
" >x &&
git diff --ignore-blank-lines >out &&
>expect &&
Expand All @@ -155,7 +155,8 @@ test_expect_success 'ignore-blank-lines: only new lines' '
test_expect_success 'ignore-blank-lines: only new lines with space' '
test_seq 5 >x &&
git update-index x &&
test_seq 5 | sed "/3/i \ " >x &&
test_seq 5 | sed "/3/i\\
" >x &&
git diff -w --ignore-blank-lines >out &&
>expect &&
test_cmp out expect
Expand Down

0 comments on commit 944adac

Please sign in to comment.