* [PATCH] gitweb: Support for custom per-project owner string
@ 2006-09-19 22:55 Petr Baudis
2006-09-19 23:04 ` Jakub Narebski
2006-09-20 15:02 ` Junio C Hamano
0 siblings, 2 replies; 6+ messages in thread
From: Petr Baudis @ 2006-09-19 22:55 UTC (permalink / raw)
To: git
This adds very simple support for per-project setting of the owner string
(in an environment where the actual owners won't have access to the
repositories accessed by gitweb, so faking identity is not an issue).
There should be an option to disable this, but this is just a patch
that someone might like (and/or pick up and polish), not intended for
inclusion as it is.
Also, ideally this would be in the configfile but calling repoconfig for
each repository in the index would slow things down way too much.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
gitweb/gitweb.perl | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 7ecd7df..d50bae5 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -818,6 +818,13 @@ sub git_get_project_owner {
}
close $fd;
}
+ if (!defined $owner and -f "$projectroot/$project/owner") {
+ if (open my $fd, "$projectroot/$project/owner") {
+ $owner = <$fd>;
+ chomp $owner;
+ close $fd;
+ }
+ }
if (!defined $owner) {
$owner = get_file_owner("$projectroot/$project");
}
@@ -2186,7 +2193,7 @@ sub git_project_list {
$pr->{'descr'} = chop_str($descr, 25, 5);
}
if (!defined $pr->{'owner'}) {
- $pr->{'owner'} = get_file_owner("$projectroot/$pr->{'path'}") || "";
+ $pr->{'owner'} = git_get_project_owner($pr->{'path'}) || "";
}
push @projects, $pr;
}
@@ -2275,7 +2282,7 @@ sub git_project_index {
foreach my $pr (@projects) {
if (!exists $pr->{'owner'}) {
- $pr->{'owner'} = get_file_owner("$projectroot/$project");
+ $pr->{'owner'} = git_get_project_owner($project);
}
my ($path, $owner) = ($pr->{'path'}, $pr->{'owner'});
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] gitweb: Support for custom per-project owner string
2006-09-19 22:55 [PATCH] gitweb: Support for custom per-project owner string Petr Baudis
@ 2006-09-19 23:04 ` Jakub Narebski
2006-09-19 23:09 ` Petr Baudis
2006-09-20 15:02 ` Junio C Hamano
1 sibling, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2006-09-19 23:04 UTC (permalink / raw)
To: git
Petr Baudis wrote:
> This adds very simple support for per-project setting of the owner string
> (in an environment where the actual owners won't have access to the
> repositories accessed by gitweb, so faking identity is not an issue).
Is it really needed? If $projects_list is a _file_, you can set correct
ownership information there.
Now $projects_list being a directory (usually $projectroot) support
hierarchy of repositories; generating appropriate projects' index file
is as easy as unsetting $projects_list (so it is by default set to
$projectroot), going to summary view, clicking [TXT] link on the left of
[OPML] link at the bottom, copy the result to projects' index file, correct
ownership information (and perhaps remove some projects), and set
$projects_list to this file.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gitweb: Support for custom per-project owner string
2006-09-19 23:04 ` Jakub Narebski
@ 2006-09-19 23:09 ` Petr Baudis
0 siblings, 0 replies; 6+ messages in thread
From: Petr Baudis @ 2006-09-19 23:09 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Dear diary, on Wed, Sep 20, 2006 at 01:04:50AM CEST, I got a letter
where Jakub Narebski <jnareb@gmail.com> said that...
> Petr Baudis wrote:
>
> > This adds very simple support for per-project setting of the owner string
> > (in an environment where the actual owners won't have access to the
> > repositories accessed by gitweb, so faking identity is not an issue).
>
> Is it really needed? If $projects_list is a _file_, you can set correct
> ownership information there.
>
> Now $projects_list being a directory (usually $projectroot) support
> hierarchy of repositories; generating appropriate projects' index file
> is as easy as unsetting $projects_list (so it is by default set to
> $projectroot), going to summary view, clicking [TXT] link on the left of
> [OPML] link at the bottom, copy the result to projects' index file, correct
> ownership information (and perhaps remove some projects), and set
> $projects_list to this file.
Which is not really easy at all. I would have to do some ugly script to
autogenerate the text file while this way I can just throw the data to
the hierarchy and having everything still working magically.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gitweb: Support for custom per-project owner string
2006-09-19 22:55 [PATCH] gitweb: Support for custom per-project owner string Petr Baudis
2006-09-19 23:04 ` Jakub Narebski
@ 2006-09-20 15:02 ` Junio C Hamano
2006-09-20 15:42 ` Petr Baudis
1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2006-09-20 15:02 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
Petr Baudis <pasky@suse.cz> writes:
> Also, ideally this would be in the configfile but calling repoconfig for
> each repository in the index would slow things down way too much.
Hmph. I wonder why. We do read description already from a file
so maybe we would want a faster way to access the config file to
grab gitweb.* variables in a single call?
In any case, I like where this patch is going and agree that
file owner should be overridable with something like this.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gitweb: Support for custom per-project owner string
2006-09-20 15:02 ` Junio C Hamano
@ 2006-09-20 15:42 ` Petr Baudis
2006-09-20 19:01 ` Jakub Narebski
0 siblings, 1 reply; 6+ messages in thread
From: Petr Baudis @ 2006-09-20 15:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Dear diary, on Wed, Sep 20, 2006 at 05:02:21PM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
>
> > Also, ideally this would be in the configfile but calling repoconfig for
> > each repository in the index would slow things down way too much.
>
> Hmph. I wonder why. We do read description already from a file
> so maybe we would want a faster way to access the config file to
> grab gitweb.* variables in a single call?
Still, opening files is _much_ faster than executing a tool, I'd say.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gitweb: Support for custom per-project owner string
2006-09-20 15:42 ` Petr Baudis
@ 2006-09-20 19:01 ` Jakub Narebski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Narebski @ 2006-09-20 19:01 UTC (permalink / raw)
To: git
Petr Baudis wrote:
> Dear diary, on Wed, Sep 20, 2006 at 05:02:21PM CEST, I got a letter
> where Junio C Hamano <junkio@cox.net> said that...
>> Petr Baudis <pasky@suse.cz> writes:
>>
>>> Also, ideally this would be in the configfile but calling repoconfig for
>>> each repository in the index would slow things down way too much.
>>
>> Hmph. I wonder why. We do read description already from a file
>> so maybe we would want a faster way to access the config file to
>> grab gitweb.* variables in a single call?
>
> Still, opening files is _much_ faster than executing a tool, I'd say.
Perhaps we should just parse $GIT_DIR/config ourself in gitweb
(this is thing that I certainly would want to see in Git.pm).
There are many modules which parse ini-like config files, but it
shouldn't be that difficult to write parser which _reads_ and parses
config file (without support for setting variables).
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-09-20 19:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-19 22:55 [PATCH] gitweb: Support for custom per-project owner string Petr Baudis
2006-09-19 23:04 ` Jakub Narebski
2006-09-19 23:09 ` Petr Baudis
2006-09-20 15:02 ` Junio C Hamano
2006-09-20 15:42 ` Petr Baudis
2006-09-20 19:01 ` Jakub Narebski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).