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>
Luben Tuikov committed
Sep 28, 2006 at 16:49 UTC
de9272f4bd029d0f331d154b59e64d160e6d1d14
1 file changed
+9
-5
gitweb/gitweb.perl
+9
-5
@@ -155,6 +155,13 @@ sub feature_snapshot {
155
return ($ctype, $suffix, $command);
156
}
157
158
+sub gitweb_have_snapshot {
159
+ my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
160
+ my $have_snapshot = (defined $ctype && defined $suffix);
161
+
162
+ return $have_snapshot;
163
+}
164
+
165
# To enable system wide have in $GITWEB_CONFIG
166
# $feature{'pickaxe'}{'default'} = [1];
167
# To have project specific config enable override in $GITWEB_CONFIG
@@ -2736,8 +2743,7 @@ sub git_blob {
2743
}
2744
2745
sub git_tree {
2739
- my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
2740
- my $have_snapshot = (defined $ctype && defined $suffix);
2746
+ my $have_snapshot = gitweb_have_snapshot();
2747
2748
if (!defined $hash) {
2749
$hash = git_get_head_hash($project);
@@ -2813,7 +2819,6 @@ sub git_tree {
2819
}
2820
2821
sub git_snapshot {
2816
-
2822
my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
2823
my $have_snapshot = (defined $ctype && defined $suffix);
2824
if (!$have_snapshot) {
@@ -2923,8 +2928,7 @@ sub git_commit {
2928
my $refs = git_get_references();
2929
my $ref = format_ref_marker($refs, $co{'id'});
2930
2926
- my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
2927
- my $have_snapshot = (defined $ctype && defined $suffix);
2931
+ my $have_snapshot = gitweb_have_snapshot();
2932
2933
my @views_nav = ();
2934
if (defined $file_name && defined $co{'parent'}) {