Skip to content

Commit

Permalink
tests: make sure input to sed is newline terminated
Browse files Browse the repository at this point in the history
POSIX only requires sed to work on text files and because it does
not end with a newline, this commit's content is not a text file.
Add a newline to fix it.  Without this change, OS X sed helpfully
adds a newline to actual.message, causing t9010.13 to fail.

Reported-by: Torsten Bögershausen <tboegi@web.de>
Tested-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  • Loading branch information
Jonathan Nieder committed Mar 29, 2011
1 parent 41e6b91 commit 4c502d6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions t/t9010-svn-fe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ test_expect_success 'NUL in log message, file content, and property name' '
OBJID
:000000 100644 OBJID OBJID A greeting
EOF
printf "\n%s" "something with an ASCII NUL (Q)" >expect.message &&
printf "\n%s\n" "something with an ASCII NUL (Q)" >expect.message &&
printf "%s\n" "helQo" >expect.hello1 &&
printf "%s\n" "link hello" >expect.hello2 &&
{
Expand Down Expand Up @@ -465,7 +465,11 @@ test_expect_success 'NUL in log message, file content, and property name' '
git diff-tree --root --stdin |
sed "s/$_x40/OBJID/g"
} >actual &&
git cat-file commit HEAD | nul_to_q | sed -ne "/^\$/,\$ p" >actual.message &&
{
git cat-file commit HEAD | nul_to_q &&
echo
} |
sed -ne "/^\$/,\$ p" >actual.message &&
git cat-file blob HEAD^:greeting | nul_to_q >actual.hello1 &&
git cat-file blob HEAD:greeting | nul_to_q >actual.hello2 &&
test_cmp expect actual &&
Expand Down

0 comments on commit 4c502d6

Please sign in to comment.