Re: [PATCH v2 10/16] engine.pl: delete the captured stderr file if empty
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 20, 2015, 18:10 UTC
- Message-ID
- <CAPig+cQxCc=HQ5-=KF5HwEQyJD88Lyw6z5R4-Jn3kwabatK_-w@mail.gmail.com>
- In-Reply-To
- <3CB33892F653436E8DCF521B61A2D48E@PhilipOakley>
On Mon, Jul 20, 2015 at 7:55 AM, Philip Oakley <philipoakley@iee.org> wrote:
Show 29 quoted lines
> From: "Eric Sunshine" <sunshine@sunshineco.com>
>> Although that works, I'm not sure that it's really all that desirable
>> due to the unnecessary and potentially confusing 'for' loop. I'd
>> probably just write it as:
>>
>> unlink $ErrsFile if -f $ErrsFile && !-s _;
>>
>> The lone '_' is magical[1] in that it re-uses the stat() information
>> from the -f rather than stat'ing $ErrsFile again. I'd also probably
>> replace !-s ("not non-zero size") with -z ("zero size"):
>>
>> unlink $ErrsFile if -f $ErrsFile && -z _;
>>
>> And, if you're using Perl 5.10 or later,
>
> The Msysgit (@1.9.5) uses perl v5.8.8, while the newer G4W SDK uses perl
> 5, version 20, subversion 2 (v5.20.2), so there is a decision to be made
> about whether to leave the Msysgit version behind.
>
> While it would be nice to use the newest version, I'm minded that we
> should keep a little backward compatibility with Msysgit, at least until
> the new G4w has had a few 'proper' releases, so not use the magic
> suggestion below.
>
>> you could use a little
>> syntactic sugar[1] and stack the file test operators up against one
>> another:
>>
>> unlink $ErrsFile if -f -z $ErrsFile;Since msysgit is only at Perl 5.8.8, it makes plenty of sense to just stick with:
unlink $ErrsFile if -f $ErrsFile && -z _;
since it's only a tiny bit more verbose than:
unlink $ErrsFile if -f -z $ErrsFile;
and then you don't have to worry about needing a more modern Perl version.
-- -- *** Please reply-to-all at all times *** *** (do not pretend to know who is subscribed and who is not) *** *** Please avoid top-posting. *** The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free. You received this message because you are subscribed to the Google Groups "msysGit" group. To post to this group, send email to msysgit@googlegroups.com To unsubscribe from this group, send email to msysgit+unsubscribe@googlegroups.com For more options, and view previous threads, visit this group at http://groups.google.com/group/msysgit?hl=en_US?hl=en --- You received this message because you are subscribed to the Google Groups "Git for Windows" group. To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.