Re: [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN.
- From
- Eric Wong <normalperson@yhbt.net>
- Date
- Jul 27, 2012, 11:34 UTC
- Message-ID
- <20120727113433.GA20883@dcvr.yhbt.net>
- In-Reply-To
- <7vobn13hps.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
> "Michael G. Schwern" <schwern@pobox.com> writes: > > +# Note: not certain why this is in use instead of die. Probably because > > +# the exit code of die is 255? Doesn't appear to be used consistently.
Yes, 255 caused problems for the test suite:
commit d25c26e771fdf771f264dc85be348719886d354f Author: Eric Wong <normalperson@yhbt.net> Date: Fri Nov 24 22:38:18 2006 -0800
git-svn: exit with status 1 for test failures
Some versions of the SVN libraries cause die() to exit with 255,
and 40cf043389ef4cdf3e56e7c4268d6f302e387fa0 tightened up
test_expect_failure to reject return values >128.Show 8 quoted lines
> > +sub fatal (@) { print STDERR "@_\n"; exit 1 }
>
> Very true. Also I do not think the line-noise prototype buys us
> anything (other than making the code look mysterious to non Perl
> programmers); we are not emulating any Perl's builtin with this
> function, and I do not see a reason why we want to force list
> context to its arguments, either. But removal of it is not part of
> this step anyway, so I wouldn't complain.I think I just learned Perl prototypes around that time :x We can certainly remove it later.
Show 10 quoted lines
> > +my $can_compress;
> > +sub can_compress {
> > + return $can_compress if defined $can_compress;
> > +
> > + return $can_compress = eval { require Compress::Zlib; } ? 1 : 0;
> > +}
>
> The original said "eval { require Compress::Zlib; 1; }"; presumably,
> when require does succeed, the value inside is the "1;" that has to
> be at the end of Compress::Zlib, so the difference should not matter.I just squashed in the simplification and made the indentation consistent with other .pm files:
return $can_compress = eval { require Compress::Zlib; };