Re: What's cooking in git.git (Nov 2010, #03; Wed, 24)
From: Jakub Narebski <hidden>
Date: 2016-06-15 22:50:10
On Fri, 3 Dec 2010, Thomas Rast wrote:
Jakub Narebski wrote:quoted
Could you add 'exit' just after second test in t/t9502-gitweb-standalone-parse-output.sh test script, or running it with `--immediate' option, and show us the results (after 'cd t') of $ file "trash directory.t9502-gitweb-standalone-parse-output/gitweb.body" should be: trash directory.t9502-gitweb-standalone-parse-output/gitweb.body: tar archiveWell, you're onto something... trash directory.t9502-gitweb-standalone-parse-output$ file * file_list: empty foo: ASCII text gitweb.body: empty gitweb_config.perl: perl script text executable gitweb.headers: ASCII text, with CRLF line terminators gitweb.log: empty gitweb.output: ASCII text, with CRLF line terminators GLOB(0xdf18fc0): tar archive Huh. Seems something got confused about what to use as a filename?
Hmmm... let me examine 17b15d4 (gitweb: File based caching layer (from git.kernel.org), 2010-11-01) Ah, I see. It looks like I forgot to update git_blob_plain and git_snapshot when I was modifying original patch by J.H. (which didn't pass test suite for other reasons) to have test for $caching_enabled outside cache_fetch(). Could you try if the following patch applied on top of 17b15d4 fixes it for you? If it does, I'll resend fixed series (yet again, I'm sorry Junio). It is not most elegant solution. Sidenote: open BINOUT, '>', \$fullhashbinpath should open in-memory file, and not be equivalent to open BINOUT, '>', "\$fullhashbinpath" Hmmm... in the case of !$caching_enabled, $fullhasbinpath is *STDOUT. BTW replacing open BINOUT, '>', \$fullhashbinpath with open BINOUT, '>&STDOUT' or open BINOUT, '>&', \$fullhashbinpath could be simpler, alternate solution. -- 8< -- 8< --
diff --git i/gitweb/gitweb.perl w/gitweb/gitweb.perl
index abaeec6..3d787c1 100755
--- i/gitweb/gitweb.perl
+++ w/gitweb/gitweb.perl@@ -5648,13 +5648,14 @@ sub git_blob_plain { local $/ = undef; if ($caching_enabled) { open BINOUT, '>', $fullhashbinpath or die_error(500, "Could not open bin dump file"); - }else{ - open BINOUT, '>', \$fullhashbinpath or die_error(500, "Could not open bin dump file"); + binmode BINOUT, ':raw'; + print BINOUT <$fd>; + close BINOUT; + } else { + binmode STDOUT, ':raw'; + print <$fd>; + binmode STDOUT, ':utf8'; # as set at the beginning of gitweb.cgi } - binmode BINOUT, ':raw'; - print BINOUT <$fd>; - binmode BINOUT, ':utf8'; # as set at the beginning of gitweb.cgi - close BINOUT; close $fd; }
@@ -5941,13 +5942,14 @@ sub git_snapshot { or die_error(500, "Execute git-archive failed"); if ($caching_enabled) { open BINOUT, '>', $fullhashbinpath or die_error(500, "Could not open bin dump file"); - }else{ - open BINOUT, '>', \$fullhashbinpath or die_error(500, "Could not open bin dump file"); + binmode BINOUT, ':raw'; + print BINOUT <$fd>; + close BINOUT; + } else { + binmode STDOUT, ':raw'; + print <$fd>; + binmode STDOUT, ':utf8'; # as set at the beginning of gitweb.cgi } - binmode BINOUT, ':raw'; - print BINOUT <$fd>; - binmode BINOUT, ':utf8'; # as set at the beginning of gitweb.cgi - close BINOUT; close $fd; } -- >8 -- >8 --
--
Jakub Narebski
Poland