{"thread":{"id":"5611","subject":"[PATCH] gitweb: Support for custom per-project owner string","startedAt":"2006-09-19T22:55:22Z","lastAt":"2006-09-20T19:01:05Z","messageCount":6,"participants":["Petr Baudis","Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27194","messageId":"20060919225522.GB13132@pasky.or.cz","threadId":"5611","inReplyTo":null,"subject":"[PATCH] gitweb: Support for custom per-project owner string","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-19T22:55:22Z","receivedAt":"2006-09-19T22:55:22Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This adds very simple support for per-project setting of the owner string\n(in an environment where the actual owners won't have access to the\nrepositories accessed by gitweb, so faking identity is not an issue).\n\nThere should be an option to disable this, but this is just a patch\nthat someone might like (and/or pick up and polish), not intended for\ninclusion as it is.\n\nAlso, ideally this would be in the configfile but calling repoconfig for\neach repository in the index would slow things down way too much.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n gitweb/gitweb.perl |   11 +++++++++--\n 1 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 7ecd7df..d50bae5 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -818,6 +818,13 @@ sub git_get_project_owner {\n \t\t}\n \t\tclose $fd;\n \t}\n+\tif (!defined $owner and -f \"$projectroot/$project/owner\") {\n+\t\tif (open my $fd, \"$projectroot/$project/owner\") {\n+\t\t\t$owner = <$fd>;\n+\t\t\tchomp $owner;\n+\t\t\tclose $fd;\n+\t\t}\n+\t}\n \tif (!defined $owner) {\n \t\t$owner = get_file_owner(\"$projectroot/$project\");\n \t}\n@@ -2186,7 +2193,7 @@ sub git_project_list {\n \t\t\t$pr->{'descr'} = chop_str($descr, 25, 5);\n \t\t}\n \t\tif (!defined $pr->{'owner'}) {\n-\t\t\t$pr->{'owner'} = get_file_owner(\"$projectroot/$pr->{'path'}\") || \"\";\n+\t\t\t$pr->{'owner'} = git_get_project_owner($pr->{'path'}) || \"\";\n \t\t}\n \t\tpush @projects, $pr;\n \t}\n@@ -2275,7 +2282,7 @@ sub git_project_index {\n \n \tforeach my $pr (@projects) {\n \t\tif (!exists $pr->{'owner'}) {\n-\t\t\t$pr->{'owner'} = get_file_owner(\"$projectroot/$project\");\n+\t\t\t$pr->{'owner'} = git_get_project_owner($project);\n \t\t}\n \n \t\tmy ($path, $owner) = ($pr->{'path'}, $pr->{'owner'});\n"},{"id":"27195","messageId":"eept0r$5d0$1@sea.gmane.org","threadId":"5611","inReplyTo":"20060919225522.GB13132@pasky.or.cz","subject":"Re: [PATCH] gitweb: Support for custom per-project owner string","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-19T23:04:50Z","receivedAt":"2006-09-19T23:04:50Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Petr Baudis wrote:\n\n> This adds very simple support for per-project setting of the owner string\n> (in an environment where the actual owners won't have access to the\n> repositories accessed by gitweb, so faking identity is not an issue).\n\nIs it really needed? If $projects_list is a _file_, you can set correct\nownership information there.\n\nNow $projects_list being a directory (usually $projectroot) support\nhierarchy of repositories; generating appropriate projects' index file\nis as easy as unsetting $projects_list (so it is by default set to\n$projectroot), going to summary view, clicking [TXT] link on the left of\n[OPML] link at the bottom, copy the result to projects' index file, correct\nownership information (and perhaps remove some projects), and set\n$projects_list to this file.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"27197","messageId":"20060919230925.GG8259@pasky.or.cz","threadId":"5611","inReplyTo":"eept0r$5d0$1@sea.gmane.org","subject":"Re: [PATCH] gitweb: Support for custom per-project owner string","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-19T23:09:25Z","receivedAt":"2006-09-19T23:09:25Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Sep 20, 2006 at 01:04:50AM CEST, I got a letter\nwhere Jakub Narebski <jnareb@gmail.com> said that...\n> Petr Baudis wrote:\n> \n> > This adds very simple support for per-project setting of the owner string\n> > (in an environment where the actual owners won't have access to the\n> > repositories accessed by gitweb, so faking identity is not an issue).\n> \n> Is it really needed? If $projects_list is a _file_, you can set correct\n> ownership information there.\n> \n> Now $projects_list being a directory (usually $projectroot) support\n> hierarchy of repositories; generating appropriate projects' index file\n> is as easy as unsetting $projects_list (so it is by default set to\n> $projectroot), going to summary view, clicking [TXT] link on the left of\n> [OPML] link at the bottom, copy the result to projects' index file, correct\n> ownership information (and perhaps remove some projects), and set\n> $projects_list to this file.\n\nWhich is not really easy at all. I would have to do some ugly script to\nautogenerate the text file while this way I can just throw the data to\nthe hierarchy and having everything still working magically.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nSnow falling on Perl. White noise covering line noise.\nHides all the bugs too. -- J. Putnam\n"},{"id":"27231","messageId":"7veju6lgxu.fsf@assigned-by-dhcp.cox.net","threadId":"5611","inReplyTo":"20060919225522.GB13132@pasky.or.cz","subject":"Re: [PATCH] gitweb: Support for custom per-project owner string","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-20T15:02:21Z","receivedAt":"2006-09-20T15:02:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> Also, ideally this would be in the configfile but calling repoconfig for\n> each repository in the index would slow things down way too much.\n\nHmph.  I wonder why.  We do read description already from a file\nso maybe we would want a faster way to access the config file to\ngrab gitweb.* variables in a single call?\n\nIn any case, I like where this patch is going and agree that\nfile owner should be overridable with something like this.\n"},{"id":"27236","messageId":"20060920154208.GN8259@pasky.or.cz","threadId":"5611","inReplyTo":"7veju6lgxu.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: Support for custom per-project owner string","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-20T15:42:08Z","receivedAt":"2006-09-20T15:42:08Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Sep 20, 2006 at 05:02:21PM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Petr Baudis <pasky@suse.cz> writes:\n> \n> > Also, ideally this would be in the configfile but calling repoconfig for\n> > each repository in the index would slow things down way too much.\n> \n> Hmph.  I wonder why.  We do read description already from a file\n> so maybe we would want a faster way to access the config file to\n> grab gitweb.* variables in a single call?\n\nStill, opening files is _much_ faster than executing a tool, I'd say.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nSnow falling on Perl. White noise covering line noise.\nHides all the bugs too. -- J. Putnam\n"},{"id":"27277","messageId":"ees35e$4vh$1@sea.gmane.org","threadId":"5611","inReplyTo":"20060920154208.GN8259@pasky.or.cz","subject":"Re: [PATCH] gitweb: Support for custom per-project owner string","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-20T19:01:05Z","receivedAt":"2006-09-20T19:01:05Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Petr Baudis wrote:\n\n> Dear diary, on Wed, Sep 20, 2006 at 05:02:21PM CEST, I got a letter\n> where Junio C Hamano <junkio@cox.net> said that...\n>> Petr Baudis <pasky@suse.cz> writes:\n>> \n>>> Also, ideally this would be in the configfile but calling repoconfig for\n>>> each repository in the index would slow things down way too much.\n>> \n>> Hmph.  I wonder why.  We do read description already from a file\n>> so maybe we would want a faster way to access the config file to\n>> grab gitweb.* variables in a single call?\n> \n> Still, opening files is _much_ faster than executing a tool, I'd say.\n\nPerhaps we should just parse $GIT_DIR/config ourself in gitweb\n(this is thing that I certainly would want to see in Git.pm).\nThere are many modules which parse ini-like config files, but it\nshouldn't be that difficult to write parser which _reads_ and parses\nconfig file (without support for setting variables).\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}