git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN.

From
Michael G Schwern <schwern@pobox.com>
Date
Jul 27, 2012, 08:19 UTC
Message-ID
<50124F19.1050502@pobox.com>
In-Reply-To
<7vobn13hps.fsf@alter.siamese.dyndns.org>
On 2012.7.26 10:18 PM, Junio C Hamano wrote:
Show 10 quoted lines
>> +# 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.
>> +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.

The prototype does absolutely nothing since @ is the default prototype. But yes, I'm doing a very rote refactoring here.

Show 9 quoted lines
>> +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.

Yes. In other situations where you cannot guarantee that the statement in the eval will return true it makes sense, but here it's redundant.

-- 
Being faith-based doesn't trump reality.
	-- Bruce Sterling
Previous: Junio C HamanoNext: Eric Wong
Message 4 of 30 in “Extract Git::SVN from git-svn, take 2.”
  1. Michael G. SchwernJul 26, 2012
  2. 1/4 Extract some utilities from git-svn to allow extracting Git::SVN.Michael G. Schwern, Jul 26, 2012
  3. Junio C HamanoJul 27, 2012
  4. Michael G SchwernJul 27, 2012
  5. Eric WongJul 27, 2012
  6. 2/4 Prepare Git::SVN for extraction into its own file.Michael G. Schwern, Jul 26, 2012
  7. Junio C HamanoJul 27, 2012
  8. Junio C HamanoJul 27, 2012
  9. Michael G SchwernJul 27, 2012
  10. Eric WongJul 27, 2012
  11. 4/4 Move initialization of Git::SVN variables into Git::SVN.Michael G. Schwern, Jul 26, 2012
  12. Junio C HamanoJul 27, 2012
  13. Jonathan NiederJul 27, 2012
  14. Junio C HamanoJul 27, 2012
  15. Junio C HamanoJul 27, 2012
  16. Junio C HamanoJul 27, 2012
  17. Eric WongJul 27, 2012
  18. Michael G SchwernJul 27, 2012
  19. Eric WongJul 27, 2012
  20. Junio C HamanoJul 27, 2012
  21. Junio C HamanoJul 27, 2012
  22. Eric WongJul 27, 2012
  23. Eric WongJul 27, 2012
  24. Junio C HamanoJul 27, 2012
  25. Eric WongJul 27, 2012
  26. Junio C HamanoJul 27, 2012
  27. Eric WongJul 27, 2012
  28. Junio C HamanoJul 27, 2012
  29. Eric WongJul 27, 2012
  30. Michael G SchwernJul 27, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.