summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorLibravatar Luben Tuikov <ltuikov@yahoo.com>2006-09-28 16:49:21 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-09-28 18:56:35 -0700
commitde9272f4bd029d0f331d154b59e64d160e6d1d14 (patch)
tree08806878350891d1fb18553696eec01520c2fee2 /gitweb
parentgitweb: Remove redundant "commit" link from shortlog (diff)
downloadtgif-de9272f4bd029d0f331d154b59e64d160e6d1d14.tar.xz
gitweb: Factor out gitweb_have_snapshot()
Create gitweb_have_snapshot() which returns true of snapshot is available and enabled, else false. Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl14
1 files changed, 9 insertions, 5 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 5ef4d07ca1..97b30aa5c5 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -155,6 +155,13 @@ sub feature_snapshot {
return ($ctype, $suffix, $command);
}
+sub gitweb_have_snapshot {
+ my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
+ my $have_snapshot = (defined $ctype && defined $suffix);
+
+ return $have_snapshot;
+}
+
# To enable system wide have in $GITWEB_CONFIG
# $feature{'pickaxe'}{'default'} = [1];
# To have project specific config enable override in $GITWEB_CONFIG
@@ -2736,8 +2743,7 @@ sub git_blob {
}
sub git_tree {
- my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
- my $have_snapshot = (defined $ctype && defined $suffix);
+ my $have_snapshot = gitweb_have_snapshot();
if (!defined $hash) {
$hash = git_get_head_hash($project);
@@ -2813,7 +2819,6 @@ sub git_tree {
}
sub git_snapshot {
-
my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
my $have_snapshot = (defined $ctype && defined $suffix);
if (!$have_snapshot) {
@@ -2923,8 +2928,7 @@ sub git_commit {
my $refs = git_get_references();
my $ref = format_ref_marker($refs, $co{'id'});
- my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
- my $have_snapshot = (defined $ctype && defined $suffix);
+ my $have_snapshot = gitweb_have_snapshot();
my @views_nav = ();
if (defined $file_name && defined $co{'parent'}) {