Skip to content

Commit 0e121a2

Browse files
jnarebgitster
authored andcommitted
gitweb: Use config file for repository description and URLs
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>
1 parent b201927 commit 0e121a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

gitweb/gitweb.perl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,9 @@ sub git_get_path_by_hash {
16061606
sub git_get_project_description {
16071607
my $path = shift;
16081608

1609-
open my $fd, "$projectroot/$path/description" or return undef;
1609+
$git_dir = "$projectroot/$path";
1610+
open my $fd, "$projectroot/$path/description"
1611+
or return git_get_project_config('description');
16101612
my $descr = <$fd>;
16111613
close $fd;
16121614
if (defined $descr) {
@@ -1618,7 +1620,11 @@ sub git_get_project_description {
16181620
sub git_get_project_url_list {
16191621
my $path = shift;
16201622

1621-
open my $fd, "$projectroot/$path/cloneurl" or return;
1623+
$git_dir = "$projectroot/$path";
1624+
open my $fd, "$projectroot/$path/cloneurl"
1625+
or return wantarray ?
1626+
@{ config_to_multi(git_get_project_config('url')) } :
1627+
config_to_multi(git_get_project_config('url'));
16221628
my @git_project_url_list = map { chomp; $_ } <$fd>;
16231629
close $fd;
16241630

0 commit comments

Comments
 (0)