Skip to content

Commit

Permalink
gitweb: fix uninitialized variable warning.
Browse files Browse the repository at this point in the history
Perl spit out a varning when "blob" or "blob_plain" actions were
used without a $hash parameter.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Martin Waitz authored and Junio C Hamano committed Sep 17, 2006
1 parent dd70235 commit 800764c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -2547,11 +2547,7 @@ sub git_heads {
}

sub git_blob_plain {
# blobs defined by non-textual hash id's can be cached
my $expires;
if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
$expires = "+1d";
}

if (!defined $hash) {
if (defined $file_name) {
Expand All @@ -2561,7 +2557,11 @@ sub git_blob_plain {
} else {
die_error(undef, "No file name defined");
}
} elsif ($hash =~ m/^[0-9a-fA-F]{40}$/) {
# blobs defined by non-textual hash id's can be cached
$expires = "+1d";
}

my $type = shift;
open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash
or die_error(undef, "Couldn't cat $file_name, $hash");
Expand Down Expand Up @@ -2589,11 +2589,7 @@ sub git_blob_plain {
}

sub git_blob {
# blobs defined by non-textual hash id's can be cached
my $expires;
if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
$expires = "+1d";
}

if (!defined $hash) {
if (defined $file_name) {
Expand All @@ -2603,7 +2599,11 @@ sub git_blob {
} else {
die_error(undef, "No file name defined");
}
} elsif ($hash =~ m/^[0-9a-fA-F]{40}$/) {
# blobs defined by non-textual hash id's can be cached
$expires = "+1d";
}

my ($have_blame) = gitweb_check_feature('blame');
open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash
or die_error(undef, "Couldn't cat $file_name, $hash");
Expand Down

0 comments on commit 800764c

Please sign in to comment.