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

Re: [PATCH] gitweb: use Git.pm, and use its parse_rev method for git_get_head_hash

From
LWLea Wiemann <lewiemann@gmail.com>
Date
May 31, 2008, 12:39 UTC
Message-ID
<4841471E.2070302@gmail.com>
In-Reply-To
<m3lk1q24nb.fsf@localhost.localdomain>
Jakub Narebski wrote:
Show 5 quoted lines
> But I'm not sure for example [that] parsing subroutines [that parse the
> output of the git commands should be in Git.pm].
> 
> [...] IMVHO caching command output is bad idea.  I'd rather have gitweb
> cache _parsed_ data (i.e. Perl structures).

Yes, I agree with you that parsed data should be cached, but for that reason I think that the subroutine that parse git's output should be in Git.pm, not in Gitweb:

If you want to cache parsed data, you need the caching layer in between the application (= Gitweb) and the repository access layer (= command output parsing), or you would have to insert cache code at every call to the repository access layer. So you end up with these layers:

(Layer 0: Front-end [HTML] caching.) Layer 1: Application (Gitweb) Layer 2: Back-end caching Layer 3: Repository access (command parsing) Layer 4: Calls to the git binary

Layer 3 and 4 are application-independent (i.e. not Gitweb specific), and since they form a usable API, they might as well be written as a separate API rather than lumped together with Gitweb. Git.pm is a start of such an API (it does layer 4 and a little bit of layer 3), so it seems natural for me to extend it.

Layer 2 is application-independent as well, so it can become an extra class in Git.pm or a separate module. (It should stay independent of layers 3 and 4).

We may need to have an explicitly implemented layer 0 (front-end caching) in Gitweb for at least a subset of pages (like project pages), but we'll see if that's necessary.

> Caching git command output (something like IPC::Cmd::Cached?)
> would only repeat bad I/O patterns of git commands.

I hope you're not assuming that the back-end cache will reside on disk -- the problem is IO throughput, so having a cache on disk can really only work for a front-end cache. For the back-end cache, we *will* have to use a memory cache (or no cache at all).

> P.S. Here it is what could go [from Gitweb] to Git.pm: [snip]

Good points, I agree those should eventually be moved to Git.pm. (They are not my priority at the moment, since I really want to implement caching. So unless they move naturally as part of my refactoring, I'll leave them in Gitweb for now.)

-- Lea
Previous: Jakub NarebskiNext: Jakub Narebski
Message 4 of 23 in “gitweb: use Git.pm, and use its parse_rev method for git_get_head_hash”
  1. gitweb: use Git.pm, and use its parse_rev method for git_get_head_hashLea Wiemann, May 30, 2008
  2. Lea WiemannMay 30, 2008
  3. Jakub NarebskiMay 31, 2008
  4. Lea WiemannMay 31, 2008
  5. Jakub NarebskiJun 1, 2008
  6. Junio C HamanoJun 2, 2008
  7. Petr BaudisJun 2, 2008
  8. Jakub NarebskiJun 2, 2008
  9. Lea WiemannJun 2, 2008
  10. Petr BaudisMay 31, 2008
  11. gitweb: use Git.pm, and use its parse_rev method for git_get_head_hashLea Wiemann, May 31, 2008
  12. Lea WiemannMay 31, 2008
  13. Junio C HamanoJun 1, 2008
  14. Lea WiemannJun 1, 2008
  15. Junio C HamanoJun 1, 2008
  16. test-lib.sh: set PERL5LIB instead of GITPERLLIBLea Wiemann, Jun 1, 2008
  17. Junio C HamanoJun 2, 2008
  18. Lea WiemannJun 2, 2008
  19. test-lib.sh: set PERL5LIB instead of GITPERLLIBLea Wiemann, Jun 2, 2008
  20. Junio C HamanoJun 2, 2008
  21. Lea WiemannJun 2, 2008
  22. Lea WiemannJun 3, 2008
  23. Lea WiemannJun 1, 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.