Re: [PATCH] Make t8001-annotate and t8002-blame more portable
- From
Junio C Hamano <junkio@cox.net>
- Date
- Jun 18, 2006, 20:58 UTC
- Message-ID
- <7v3be218ri.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20060618203321.G2e8b0080@leonov.stosberg.net>
Dennis Stosberg <dennis@stosberg.net> writes:
Show 5 quoted lines
> These two tests assume that "sed" will not modify the final line of a > stream if it does not end with a newline character. The assumption is > not true at least for FreeBSD and Solaris 9. FreeBSD's "sed" appends > a newline character; "sed" in Solaris 9 even removes the incomplete > final line.
Gaaah.
Show 5 quoted lines
> - 'mv file file1 && > - sed -e 1d -e "5s/3A/99/" file1 >file && > - rm -f file1 && > + 'perl -pi -e "s/^1A.*\n$//; s/^3A/99/" file && > GIT_AUTHOR_NAME="D" git commit -a -m "edit"'
The first line in the original is removed while the perl version seems to just makes it empty -- ah, you remove the trailing LF as well there. I've never seen this done like this, but OK.
It would have been more obvious if it were written like this:
$_ = "" if ($. == 1);
but probably it is just me.
Thanks for the patch.