Re: Diffs from CVS keyword expansion

2 messages, 2 authors, 2016-08-11 · open the first message on its own page

Re: Diffs from CVS keyword expansion

From: Junio C Hamano <hidden>
Date: 2016-08-11 19:34:19

merlyn@stonehenge.com (Randal L. Schwartz) writes:
quoted
quoted
quoted
quoted
quoted
"Uwe" == Uwe Kleine-Koenig [off-list ref] writes:
Uwe> 	#! /bin/sh
Uwe> 	exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@";

Ow.  My eyes hurt from that.  How about we rewrite that as a native Perl
script:

    #!/usr/bin/perl
    $^I = ""; # this is -i
    while (<>) {
      s/\$(Id|Revision):.*?\$/\$$1: \$/;
      print;
    }
That's kinda surprising coming from the resident Perl guru.

I am so used to the command line "-i -p" that I did not even
know what $^I does, and I would have lost without your "# this
is -i" comment.  That alone makes the Uwe's one more readable
for me ;-).

Re: Diffs from CVS keyword expansion

From: Robin Rosenberg <hidden>
Date: 2016-08-11 20:03:00

tisdag 05 december 2006 20:55 skrev Junio C Hamano:
merlyn@stonehenge.com (Randal L. Schwartz) writes:
quoted
quoted
quoted
quoted
quoted
quoted
"Uwe" == Uwe Kleine-Koenig [off-list ref]
writes:
Uwe> 	#! /bin/sh
Uwe> 	exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@";

Ow.  My eyes hurt from that.  How about we rewrite that as a native Perl
script:

    #!/usr/bin/perl
    $^I = ""; # this is -i
    while (<>) {
      s/\$(Id|Revision):.*?\$/\$$1: \$/;
      print;
    }
That's kinda surprising coming from the resident Perl guru.

I am so used to the command line "-i -p" that I did not even
know what $^I does, and I would have lost without your "# this
is -i" comment.  That alone makes the Uwe's one more readable
for me ;-).
May I suggest a compromise? : 

#!/usr/bin/perl -i -p
s/\$(Id|Revision):.*?\$/\$$1: \$/;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help