[PATCH] gitweb: Use config file or file for repository owner's name.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow to use configuration variable gitweb.owner or $GIT_DIR/owner file to
set the repository owner, it checks $GIT_DIR/owner first, then falls back to
the gitweb.owner, if none exist uses filesystem directory's owner.

Useful when we don't want to maintain project list file, and all
repository directories have to have the same owner (for example when the
same SSH account is shared for all projects, using ssh_acl to control
access instead).

Signed-off-by: Bruno Ribas <ribas@xxxxxxxxxxxx>
---
 gitweb/gitweb.perl |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 6256641..e29ad0a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1754,6 +1754,20 @@ sub git_get_project_list_from_file {
 	}
 }
 
+sub gitweb_get_project_owner {
+	my $path = shift;
+
+	$git_dir = "$projectroot/$path";
+	open my $fd, "$projectroot/$path/owner"
+		or return git_get_project_config('owner');
+	my $owner = <$fd>;
+	close $fd;
+	if (defined $owner) {
+		chomp $owner;
+	}
+	return $owner;
+}
+
 sub git_get_project_owner {
 	my $project = shift;
 	my $owner;
@@ -1767,6 +1781,10 @@ sub git_get_project_owner {
 	if (exists $gitweb_project_owner->{$project}) {
 		$owner = $gitweb_project_owner->{$project};
 	}
+
+    if (!defined $owner) {
+        $owner = gitweb_get_project_owner($project);
+    }
 	if (!defined $owner) {
 		$owner = get_file_owner("$projectroot/$project");
 	}
-- 
1.5.3.8

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux