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

Re: [PATCH] Avoid errors from git-rev-parse in gitweb blame

From
Jakub Narebski <jnareb@gmail.com>
Date
Jun 4, 2008, 12:31 UTC
Message-ID
<200806041431.07494.jnareb@gmail.com>
In-Reply-To
<4845E45E.9030504@gmail.com>
Lea Wiemann wrote:
Show 7 quoted lines
> Jakub Narebski wrote:
> >
> > And snapshots [and blob_plain].  We certainly want to stream snapshots, as
> > they can be quite large.
> 
> Yup.  I suppose that those need to be cached on disk rather than in 
> memory, so they need a separate cache.

Or at least (in the first implementation) to avoid caching them in memory-based cache (and serve them uncached).

Although I wonder how memory-based caches such as memcached or swifty, and perhaps also mmap based cache (BerkeleyDB based cache is supposedly fast because it fits into memory/caches in memory) deals with overly large cache entries...

Show 7 quoted lines
> > [Parents in blame output:]
> > It perhaps makes no difference performance wise (solution with
> > "git rev-list --parents --no-walk" has one fork more), but it might
> > make code unnecessarily more complicated.
> 
> A few lines.  *shrugs*  Probably actually easier than adding stuff to 
> git-blame's output, but I won't argue against the latter if you want it.

With modified (enhanced) git-blame output code would look like this (rough pseudocode):

  while (<$fd>) {
    ...
    <parse 'parent' header>
    ...
  }

while using no-walk rev-list requires list of blamed parents upfront, so the code would have to look like this

  @blame_data = <$fd>;
  @commitlist = map { <get sha1> } grep { <header line> } @blame_list;
  %commit_parents = get_parents(\@commitlist); # calls git-rev-list
  foreach (@commitlist) {
    ...
    ...
  }

Note that you read whole data into gitweb, inclreasing memory usage... which we want to avoid, especially when using memcached or similar caching backend (git-blame itself has to keep data in memory, but no need to duplicate the amount).

Besides git-blame output needs to be extended/enhanced anyway for the data mining / annotated file history navigation Luben wanted to be really robust. See my response to Linus email in this thread (to be written).

Show 6 quoted lines
> > use AJAX together with "git blame --incremental" to reduce latency.
> > It was done by having JavaScript check if browser is AJAX-capable,
> 
> Unfortunately there is no such check (and I doubt it's doable without 
> cookie or redirect trickery) -- you'll find that the blames on 
> repo.or.cz don't work without JavaScript.

I have in my git repository original version (well, one of original versions) adding incremental blame output

  Message-ID: <20070825222404.16967.9402.stgit@rover>
  http://permalink.gmane.org/gmane.comp.version-control.git/56657

by Petr Baudis, tweaked version of Fredrik Kuivinen patch, and in the commit message there is the floowing info:

    Compared to the original patch, this one works with pathinfo-ish URLs as
    well, and should play well with non-javascript browsers as well (the HTML
    points to the blame action, while javascript code rewrites the links to use
    the blame_incremental action; it is somewhat hackish but I couldn't think
    of a better solution).

Instead of rewriting links gitweb's JavaScript could use JavaScript redirect trickery, using JavaScript (by setting location.href for example) to redirect to blame_incremental action from blame action.

As to checking if browser is AJAX capable: you can at least check if all methods needed are available.

P.S. You would probably want to remove old git-annotate based git_blame (dead code, currently not used by any action), and rename git_blame2 to git_blame. A bit less code to check for caching problems etc,...

-- 
Jakub Narebski
Poland
Previous: Lea WiemannNext: Lea Wiemann
Message 34 of 40 in “Avoid errors from git-rev-parse in gitweb blame”
  1. Avoid errors from git-rev-parse in gitweb blameRafael Garcia-Suarez, Jun 3, 2008
  2. Lea WiemannJun 3, 2008
  3. Jakub NarebskiJun 3, 2008
  4. Rafael Garcia-SuarezJun 3, 2008
  5. Jakub NarebskiJun 3, 2008
  6. Rafael Garcia-SuarezJun 3, 2008
  7. Jakub NarebskiJun 3, 2008
  8. Rafael Garcia-SuarezJun 3, 2008
  9. Jakub NarebskiJun 3, 2008
  10. Rafael Garcia-SuarezJun 3, 2008
  11. Jakub NarebskiJun 3, 2008
  12. Rafael Garcia-SuarezJun 3, 2008
  13. Jakub NarebskiJun 3, 2008
  14. Luben TuikovJun 3, 2008
  15. Luben TuikovJun 3, 2008
  16. Luben TuikovJun 3, 2008
  17. Jakub NarebskiJun 3, 2008
  18. Junio C HamanoJun 4, 2008
  19. Jakub NarebskiJun 4, 2008
  20. Junio C HamanoJun 5, 2008
  21. 1/2 git-blame: refactor code to emit "porcelain format" outputJunio C Hamano, Jun 5, 2008
  22. Jakub NarebskiJun 6, 2008
  23. 2/2 blame: show "previous" information in --porcelain/--incremental formatJunio C Hamano, Jun 5, 2008
  24. Jakub NarebskiJun 6, 2008
  25. Junio C HamanoJun 6, 2008
  26. Jakub NarebskiJun 6, 2008
  27. Jakub NarebskiJun 6, 2008
  28. Luben TuikovJun 4, 2008
  29. Lea WiemannJun 3, 2008
  30. Jakub NarebskiJun 3, 2008
  31. Lea WiemannJun 3, 2008
  32. Jakub NarebskiJun 4, 2008
  33. Lea WiemannJun 4, 2008
  34. Jakub NarebskiJun 4, 2008
  35. Lea WiemannJun 8, 2008
  36. Jakub NarebskiJun 8, 2008
  37. Luben TuikovJun 3, 2008
  38. Jakub NarebskiJun 3, 2008
  39. Luben TuikovJun 3, 2008
  40. Jakub NarebskiJun 3, 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.