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>
Jakub Narebski committed
Nov 3, 2007 at 00:41 UTC
0e121a2cd42d28bc4034feedf8a13c5a91f85bd3
1 file changed
+8
-2
gitweb/gitweb.perl
+8
-2
@@ -1606,7 +1606,9 @@ sub git_get_path_by_hash {
1606
sub git_get_project_description {
1607
my $path = shift;
1608
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');
1612
my $descr = <$fd>;
1613
close $fd;
1614
if (defined $descr) {
@@ -1618,7 +1620,11 @@ sub git_get_project_description {
1620
sub git_get_project_url_list {
1621
my $path = shift;
1622
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'));
1628
my @git_project_url_list = map { chomp; $_ } <$fd>;
1629
close $fd;
1630