gitweb: fix uninitialized variable warning.
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>
Martin Waitz committed
Sep 16, 2006 at 23:09 UTC
800764cf335cb4de289269c919e865c536635885
1 file changed
+8
-8
gitweb/gitweb.perl
+8
-8
@@ -2547,11 +2547,7 @@ sub git_heads {
2547
}
2548
2549
sub git_blob_plain {
2550
- # blobs defined by non-textual hash id's can be cached
2550
my $expires;
2552
- if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
2553
- $expires = "+1d";
2554
- }
2551
2552
if (!defined $hash) {
2553
if (defined $file_name) {
@@ -2561,7 +2557,11 @@ sub git_blob_plain {
2557
} else {
2558
die_error(undef, "No file name defined");
2559
}
2560
+ } elsif ($hash =~ m/^[0-9a-fA-F]{40}$/) {
2561
+ # blobs defined by non-textual hash id's can be cached
2562
+ $expires = "+1d";
2563
}
2564
+
2565
my $type = shift;
2566
open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash
2567
or die_error(undef, "Couldn't cat $file_name, $hash");
@@ -2589,11 +2589,7 @@ sub git_blob_plain {
2589
}
2590
2591
sub git_blob {
2592
- # blobs defined by non-textual hash id's can be cached
2592
my $expires;
2594
- if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
2595
- $expires = "+1d";
2596
- }
2593
2594
if (!defined $hash) {
2595
if (defined $file_name) {
@@ -2603,7 +2599,11 @@ sub git_blob {
2599
} else {
2600
die_error(undef, "No file name defined");
2601
}
2602
+ } elsif ($hash =~ m/^[0-9a-fA-F]{40}$/) {
2603
+ # blobs defined by non-textual hash id's can be cached
2604
+ $expires = "+1d";
2605
}
2606
+
2607
my ($have_blame) = gitweb_check_feature('blame');
2608
open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash
2609
or die_error(undef, "Couldn't cat $file_name, $hash");