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

Re: [PATCH] gitweb: return correct HTTP status codes

From
Jakub Narebski <jnareb@gmail.com>
Date
Jun 18, 2008, 07:35 UTC
Message-ID
<200806180935.54712.jnareb@gmail.com>
In-Reply-To
<48586400.4000504@gmail.com>
Lea Wiemann wrote:
Show 9 quoted lines
> Jakub Narebski wrote:
>> Lea Wiemann wrote:
>>>
>>> $hash = get_hash($symbol, 'commit'); # 'commit' to resolve tags
>> 
>> Errr... is there equivalent to ^{}, i.e. resolve to non-tag?
> 
> Yup.  Haven't quite decided whether to simply use "$symbol^{type}" or 
> make type a separate parameter.

Although I think this won't be necessary for gitweb, the ability should (I guess) be in generic object-oriented interface like Git::Repo module.

>> Note that you would have to examine gitweb sources to check if it
>> uses href(..., -replay=>1) when it should,
> 
> Good point, will do.
It should, but I might have missed something.
Show 9 quoted lines
>> BTW. one of earliest idea was to fully resolve hashes, add missing
>> parameters if possible (like 'h', 'hp', 'f') and convert hashes to
>> sha-1.  One of intended uses was (weak) ETag for simple HTTP caching.
> 
> Interesting.  Something to keep in mind is that using name-rev still can 
> wreck with this since it has the unique property of taking hashes but 
> still depending on the current refs.  Gitweb isn't using name-rev a lot 
> right now, but that might change of course (e.g. I think that it would 
> be convenient to always display names along with any commit hashes).

Well, you will have two level cache: first from refnames[*1*] to hashes (by the way I think you can treat tag names as valid indifinitely, and use them in the place of full sha-1 hashes; thanks to heads<->tags ambiguity gitweb now spells tags in full as refs/heads/<tag>), second from "normalized" URLs to content, or rather from "normalized" URL derivative to data used to generate content.

So I think you can use first-level cache to calculate equivalent of 'name-rev', or keep cached 'name-rev' there.

Currently gitweb uses name-rev only in (I think) rarely used 'raw' (text/plain) version of 'commit' and 'commitdiff' views... and I think it is here to stay thanks to gitk like displaying refs marks in log-like views (I think result of git_get_references() should also be cached...).

[*1*] Well, project name (repository path) + refname.
We will see if this two-tier cache solution is good idea...
Show 5 quoted lines
>> All the time I think that caching _everything_ is a bad solution.
> 
> So?  We can easily add an option to the cache; e.g. no_cache => 
> ['get_blob', 'ls_tree'].  I doubt that it will be needed, but if it 
> does, it's easy to add it.  Don't worry about it, really.

Well, on the other hand from what I understand kernel.org gitweb caches unconditionally (but adaptively) every page, same with CGit (used for example on freedesktop.org).

It would be nice to have some stats of gitweb access (e.g. from repo.or.cz and kernel.org).

Show 5 quoted lines
>> CHI (or other in recommended thread) for inobtrusive data caching
> 
> Thanks for the pointer!  On the one hand CHI is very recent and not even 
> in Debian, on the other hand it provides things like busy_lock on top of 
> Memcached (AFAICS), at fairly little cost.  I'll look into it.
I was not thinking about using CHI, or any Perl module metioned in
  "[RFD] Gitweb caching, part 3: examining Perl modules for caching (long)"
  http://thread.gmane.org/gmane.comp.version-control.git/77529/focus=77527

(perhaps with exception of Cache::Cache and its submodules/engines), but rather about emulating best of its interfaces (well, perhaps also "borrowing" some of its code, if license permits).

-- 
Jakub Narebski
Poland
Previous: Lea WiemannNext: Jakub Narebski
Message 16 of 25 in “gitweb: return correct HTTP status codes”
  1. gitweb: return correct HTTP status codesLea Wiemann, Jun 15, 2008
  2. Jakub NarebskiJun 15, 2008
  3. Lea WiemannJun 16, 2008
  4. Jakub NarebskiJun 16, 2008
  5. Lea WiemannJun 16, 2008
  6. Jakub NarebskiJun 16, 2008
  7. Lea WiemannJun 17, 2008
  8. Junio C HamanoJun 16, 2008
  9. Lea WiemannJun 17, 2008
  10. Jakub NarebskiJun 17, 2008
  11. Lea WiemannJun 17, 2008
  12. Jakub NarebskiJun 17, 2008
  13. Lea WiemannJun 17, 2008
  14. Jakub NarebskiJun 18, 2008
  15. Lea WiemannJun 18, 2008
  16. Jakub NarebskiJun 18, 2008
  17. Jakub NarebskiJun 16, 2008
  18. gitweb: standarize HTTP status codesLea Wiemann, Jun 18, 2008
  19. Jakub NarebskiJun 19, 2008
  20. Lea WiemannJun 19, 2008
  21. gitweb: standarize HTTP status codesLea Wiemann, Jun 19, 2008
  22. gitweb: standarize HTTP status codesLea Wiemann, Jun 19, 2008
  23. Jakub NarebskiJun 19, 2008
  24. Junio C HamanoJun 20, 2008
  25. Jakub NarebskiJun 19, 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.