aboutsummaryrefslogtreecommitdiff
path: root/gitweb/gitweb.perl
diff options
context:
space:
mode:
authorMartin Waitz <tali@admingilde.org>2006-09-16 23:09:02 +0200
committerJunio C Hamano <junkio@cox.net>2006-09-17 01:58:56 -0700
commit800764cf335cb4de289269c919e865c536635885 (patch)
tree52ecbb08a58b3d8e8062992685e34b2897367fbe /gitweb/gitweb.perl
parentdd70235f5a81e52725365365a554cf7c8cfa37e6 (diff)
downloadgit-800764cf335cb4de289269c919e865c536635885.tar.gz
git-800764cf335cb4de289269c919e865c536635885.tar.xz
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>
Diffstat (limited to 'gitweb/gitweb.perl')
-rwxr-xr-xgitweb/gitweb.perl16
1 files changed, 8 insertions, 8 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 645ae795c..250138520 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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) {
@@ -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");
@@ -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) {
@@ -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");