Re: [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed
- From
Brandon Casey <casey@nrlssc.navy.mil>
- Date
- May 7, 2009, 14:57 UTC
- Message-ID
- <_6ButG1D1Yw2WmmzcwyJjDYXsQ4Xp1VSI7VKH_AFjgKZ7nVeFjzl3g@cipher.nrlssc.navy.mil>
- In-Reply-To
- <4A028D24.9@viscovery.net>
Johannes Sixt wrote:
Show 25 quoted lines
> Brandon Casey schrieb:
>> Some versions of sed exit non-zero if the file they are supplied is not
>> newline terminated. Solaris's /usr/xpg4/bin/sed is one such sed. So
>> rework this test to avoid doing so.
>> ---
>> t/t4200-rerere.sh | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
>> index b68ab11..48dbd8e 100755
>> --- a/t/t4200-rerere.sh
>> +++ b/t/t4200-rerere.sh
>> @@ -190,7 +190,7 @@ test_expect_success 'file2 added differently in two branches' '
>> git add file2 &&
>> git commit -m version2 &&
>> test_must_fail git merge fourth &&
>> - sha1=$(sed -e "s/ .*//" .git/MERGE_RR) &&
>> + sha1=$({ cat .git/MERGE_RR; echo; } | sed -e "s/ .*//") &&
>
> Couldn't that line become
>
> sha1=$(cat .git/MERGE_RR) &&
> sha1=%{sha1%% *} &&
>
> (a literal tab before the '*')?Yes, that works here. The line above has been removed so it's moot for this case. Your change could be applied at line 60 of t4200-rerere.sh to replace my perl call that was just applied if you think it is worth it.
-brandon