git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 4, 2008, 14:00 UTC
Message-ID
<200802041500.49682.jnareb@gmail.com>
In-Reply-To
<20080204133542.GA8197@c3sl.ufpr.br>
On Mon, 4 Feb 2008, Bruno Cesar Ribas wrote:
> On Fri, Feb 01, 2008 at 01:17:07AM +0100, Jakub Narebski wrote:
>><snip> 
>> Note that some of info is needed for 'projects_list' view, and some only
>> for the 'summary' view.
Show 22 quoted lines
>> Currently for 'projects_list' view we have, when $projects_list is
>> a directory (this includes situation when it is undef, and fallbacks
>> to $projectroot):
>>  1. Call git-for-each-ref to get last modification time
>>  2. Read $git_dir/description file for description (which is generated
>>     by default template, so is usualy present, if in useless form),
>>     fallback to git-config / reading $git_dir/config, gitweb.description
>>  3. Check owner of $git_dir (stat + getpwuid)
>> 
>> With the addition of $git_dir/owner and gitweb.owner we would have
>>  3'. Read $git_dir/owner file, usually not present,
>>      fallback to gitweb.owner (which means reading and parsing
>>      repo config!),
>>      fallback to $git_dir owner (stat + getpwuid)
>> so after consideration I think that adding gitweb.owner is a bit of
>> a stupid idea from performance point of view, at least till we have
>> 'projects_list' caching. Only $git_dir/owner would be better.
> 
> Unless we parse config only once for each project. We can create a small
> cache with all gitweb conf. Then each time we ask
> git_get_project_config('bla') we check if we alread had parsed it, if parsed 
> get in a small hash table.

If you have read gitweb.perl current code more carefully, or browsed "git log -- gitweb" output, you would notice that since b201927a

  gitweb: Read repo config using 'git config -z -l'

gitweb does just that. Reads whole repo config using "git config -z -l" (this additionally includes support for user and system git configuration files; also git config file format has some hairy corners) into hash lazily, then uses this hash.

But this is once per repo, which for 'projects_list' might be too much, especialy for the operating systems where fork is slow. I'd rather go in opposite direction and add support for providing description in 'projects_list' file.

> We could even check if we are generating project list then we can store only
> description and owner. (this sounds ugly)

This doesn't buy us much, because description and owner migh be in the last lines of repo config, so we have to read whole config file in full.

Note that if I understand this correctly variable initialization, including %config and $config_file are generated anew for each request. Besides, as it is now, viewing some project view would flush out projects_list %config, etc.

Show 11 quoted lines
>> Another solution would be using $projectroot/.gitconfig, with simplified
>> syntax easy parseable by Perl, with gitweb.<repo path>.<config>, where
>> <config> is limited to 'description', 'owner' and 'url', and 
>> gitweb.description for fallback description, gitweb.owner for fallback
>> owner and owner for set of repositories, gitweb.baseurl for base URLs
>> (gitweb.<repo>.url = gitweb.baseurl/<repo>).
> 
> This sounds good.  Having this small, simple file would make things better.
> But we will have another file inside repository, having all in config would
> be cleaner [i guess]. If we parse config file only once per project might be
> good.
 
I think that it would be better to separate gitweb configuration
(in gitweb_config.perl) fro [cached] repositories configuration
(in gitconfig or .gitconfig). 
-- 
Jakub Narebski
Poland
Previous: Bruno Cesar RibasNext: Bruno Cesar Ribas
Message 12 of 16 in “gitweb: Use config file or file for repository owner's name.”
  1. gitweb: Use config file or file for repository owner's name.Bruno Ribas, Jan 30, 2008
  2. gitweb: Update gitweb/README to include the new per-repository configurationBruno Ribas, Jan 30, 2008
  3. Junio C HamanoJan 30, 2008
  4. Bruno Cesar RibasJan 31, 2008
  5. Junio C HamanoJan 31, 2008
  6. Bruno Cesar RibasJan 31, 2008
  7. Junio C HamanoJan 31, 2008
  8. Jakub NarebskiJan 31, 2008
  9. Johannes SchindelinJan 31, 2008
  10. Jakub NarebskiFeb 1, 2008
  11. Bruno Cesar RibasFeb 4, 2008
  12. Jakub NarebskiFeb 4, 2008
  13. Bruno Cesar RibasFeb 5, 2008
  14. Jakub NarebskiFeb 5, 2008
  15. Bruno Cesar RibasFeb 5, 2008
  16. Bruno Cesar RibasFeb 7, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.