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

Re: [PATCH v2 6/8] gitweb: Push formatting diff lines to print_diff_chunk()

From
Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Date
Mar 29, 2012, 17:41 UTC
Message-ID
<20120329194153.2e1ad827@gmail.com>
In-Reply-To
<201203291859.44891.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> wrote:
Show 18 quoted lines
> On Fri, 23 Mon 2012, Michał Kiedrowicz wrote:
> 
> > Now git_patchset_body() only calls diff_line_class(), which is removed
> > from process_diff_line(). The latter function is renamed to
> > format_diff_line() and its output is changed to return only
> > HTML-formatted line, which brings it in line with outher format_*
> > subroutined.
> > 
> > This slightly changes the order of operations performed on diff lines.
> > Before this commit, each read line was formatted and then put to the
> > @chunk accumulator. Now, lines are formatted inside print_diff_chunk(),
> 
> This is a bit convoluted description.
> 
> 
> As I understand it, what happens here is that formatting lines is
> pushed down to print_diff_chunk(), closer to the place where we
> actually use HTML formatted output.
Yes.
Show 9 quoted lines
> 
> This means that we put raw lines in the @chunk accumulator, rather
> than formatted lines.  Because we still need to know class (type)
> of line when accumulating data to post-process and print, 
> process_diff_line() subroutine was retired and replaced by 
> diff_line_class() used in git_patchset_body() and new / resurrected
> format_diff_line() used in print_diff_chunk().
> 
> Isn't it?
Very true.
>  
> 
> A side effect is that we have to pass \%from and \%to down the
> callstack.
Yes.
Show 11 quoted lines
> 
> > This is a preparation patch for diff refinement highlightning. It's not
> > meant to change gitweb output.
> > 
> This is a very nice refactoring.  I was never really comfortable with
> the API of process_diff_line(), which was different from all other
> subroutines in gitweb, and error prone to call.  I wish we used this
> solution presented in this commit from the very beginning.
> 
> BTW. I think we can simply squash this commit with previous one; no
> need to improve process_diff_line() if we are retiring it.
OK, will do.
Show 7 quoted lines
> 
> > Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
> > Acked-by: Jakub Narębski <jnareb@gmail.com>
> > ---
> >  gitweb/gitweb.perl |   25 ++++++++++++-------------
> >  1 files changed, 12 insertions(+), 13 deletions(-)
> 
Previous: Jakub NarebskiNext: Michał Kiedrowicz
Message 24 of 30 in “gitweb: Highlight interesting parts of diff”
  1. 0/8 gitweb: Highlight interesting parts of diffMichał Kiedrowicz, Mar 23, 2012
  2. 1/8 gitweb: esc_html_hl_regions(): Don't create empty <span> elementsMichał Kiedrowicz, Mar 23, 2012
  3. Jakub NarebskiMar 24, 2012
  4. Michał KiedrowiczMar 24, 2012
  5. gitweb: Use descriptive names in esc_html_hl_regions()Michał Kiedrowicz, Mar 29, 2012
  6. 2/8 gitweb: Pass esc_html_hl_regions() options to esc_html()Michał Kiedrowicz, Mar 23, 2012
  7. Jakub NarebskiMar 24, 2012
  8. Michał KiedrowiczMar 24, 2012
  9. 3/8 gitweb: Extract print_sidebyside_diff_lines()Michał Kiedrowicz, Mar 23, 2012
  10. Jakub NarebskiMar 28, 2012
  11. Michał KiedrowiczMar 29, 2012
  12. Jakub NarebskiMar 30, 2012
  13. 4/8 gitweb: Use print_diff_chunk() for both side-by-side and inline diffsMichał Kiedrowicz, Mar 23, 2012
  14. Jakub NarebskiMar 28, 2012
  15. Michał KiedrowiczMar 29, 2012
  16. Jakub NarebskiMar 30, 2012
  17. Michal KiedrowiczMar 30, 2012
  18. 5/8 gitweb: Move HTML-formatting diff line back to process_diff_line()Michał Kiedrowicz, Mar 23, 2012
  19. Jakub NarebskiMar 29, 2012
  20. Jakub NarebskiMar 29, 2012
  21. Michał KiedrowiczMar 29, 2012
  22. 6/8 gitweb: Push formatting diff lines to print_diff_chunk()Michał Kiedrowicz, Mar 23, 2012
  23. Jakub NarebskiMar 29, 2012
  24. Michał KiedrowiczMar 29, 2012
  25. 7/8 gitweb: Highlight interesting parts of diffMichał Kiedrowicz, Mar 23, 2012
  26. Jakub NarebskiMar 29, 2012
  27. Michał KiedrowiczMar 29, 2012
  28. 8/8 gitweb: Refinement highlightning in combined diffsMichał Kiedrowicz, Mar 23, 2012
  29. Jakub NarebskiMar 29, 2012
  30. Michal KiedrowiczMar 30, 2012

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.