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

From: Junio C Hamano <[email-masked]>
Date: Tue, 29 Jan 2008 22:16:16 -0800

Bruno Ribas <[email-masked]> writes:

> 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).

> +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");
>  	}

I am not sure about the effect of this change on a large scale
site.  If you do not have the project list file, originally we
just needed a stat per project, but now you open an extra file
(either "owner" or "config") and read it, once per every
project.

The project list page does that for every project, and it
actually is worse because it also needs to open yet another file
"description" from the directory.  It almost makes me wonder if
are much better of to have a single file per project to read all
the necessary information off of, instead of having to open many
little files (currently it is only two---owner and description.
But who knows what other little pieces of information you would
want to add next week).