git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Thomas Rast <trast@student.ethz.ch>
Cc: John 'Warthog9' Hawley <warthog9@kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: What's cooking in git.git (Nov 2010, #03; Wed, 24)
Date: Fri, 3 Dec 2010 15:12:44 +0100	[thread overview]
Message-ID: <201012031512.45793.jnareb@gmail.com> (raw)
In-Reply-To: <201012031406.55854.trast@student.ethz.ch>

On Fri, 3 Dec 2010, Thomas Rast wrote:
> Jakub Narebski wrote:
> > 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 archive
> 
> Well, 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

  reply	other threads:[~2010-12-03 14:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25  3:16 What's cooking in git.git (Nov 2010, #03; Wed, 24) Junio C Hamano
2010-11-25  3:42 ` Jiang Xin
2010-11-25  9:45 ` Ævar Arnfjörð Bjarmason
2010-11-25 10:35   ` Erik Faye-Lund
2010-11-25 12:00     ` Ævar Arnfjörð Bjarmason
2010-11-25 12:34       ` Erik Faye-Lund
2010-11-25 14:54         ` Erik Faye-Lund
2010-11-25 15:03           ` Erik Faye-Lund
2010-11-25 15:22             ` Erik Faye-Lund
2010-11-25 16:33             ` Ævar Arnfjörð Bjarmason
2010-11-25 17:55               ` Erik Faye-Lund
2010-11-25 18:06                 ` Ævar Arnfjörð Bjarmason
2010-11-25 20:02                   ` Erik Faye-Lund
2010-11-26  0:40                     ` Ævar Arnfjörð Bjarmason
2010-11-25 10:41   ` Johannes Sixt
2010-11-25 16:26 ` Jakub Narebski
2010-12-03 10:36 ` Thomas Rast
2010-12-03 11:13   ` Jakub Narebski
2010-12-03 11:22     ` Thomas Rast
2010-12-03 13:02       ` Jakub Narebski
2010-12-03 13:06         ` Thomas Rast
2010-12-03 14:12           ` Jakub Narebski [this message]
2010-12-03 15:03             ` Thomas Rast

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012031512.45793.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=trast@student.ethz.ch \
    --cc=warthog9@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).