Skip to content

Commit

Permalink
gitweb: Factor out gitweb_have_snapshot()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luben Tuikov authored and Junio C Hamano committed Sep 29, 2006
1 parent d1d866e commit de9272f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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'}) {
Expand Down

0 comments on commit de9272f

Please sign in to comment.