Skip to content

Commit

Permalink
gitweb: Use config file for repository description and URLs
Browse files Browse the repository at this point in the history
Allow to use configuration variable gitweb.description for repository
description if there is no $GIT_DIR/description file, and multivalued
configuration variable gitweb.url for URLs of a project (to clone or
fetch from) if there is no $GIT_DIR/cloneurl file.

While repository description is shown in the projects list page, so it
is better to use file and not config variable for performance, it is I
think better to use gitweb.url for URLs (as it is shown only on
project summary page).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Nov 3, 2007
1 parent b201927 commit 0e121a2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,9 @@ sub git_get_path_by_hash {
sub git_get_project_description {
my $path = shift;

open my $fd, "$projectroot/$path/description" or return undef;
$git_dir = "$projectroot/$path";
open my $fd, "$projectroot/$path/description"
or return git_get_project_config('description');
my $descr = <$fd>;
close $fd;
if (defined $descr) {
Expand All @@ -1618,7 +1620,11 @@ sub git_get_project_description {
sub git_get_project_url_list {
my $path = shift;

open my $fd, "$projectroot/$path/cloneurl" or return;
$git_dir = "$projectroot/$path";
open my $fd, "$projectroot/$path/cloneurl"
or return wantarray ?
@{ config_to_multi(git_get_project_config('url')) } :
config_to_multi(git_get_project_config('url'));
my @git_project_url_list = map { chomp; $_ } <$fd>;
close $fd;

Expand Down

0 comments on commit 0e121a2

Please sign in to comment.