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

Re: [PATCH/RFC 1/2] gitweb: change format_diff_line() to remove leading SP from $diff_class

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 17, 2011, 23:20 UTC
Message-ID
<7vehybjjdd.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201110180007.31008.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
Show 10 quoted lines
> O.K.
>
>>                 [" {$num_sign}", ""],
>
> O.K.
>
>>                 ["[+ ]{$num_sign}", "add"],
>>                 ["[- ]{$num_sign}", "rem"],
>
> It would be slightly different to what current code does.
> Current code for combined diff uses "add" if there is at least one '+',
> "rem" if there are no '+' and at least one '-', and context otherwise.

The only possible difference would be for a line with all blank, but because there is an additional explicit rule for context, the behaviour is the same. In a combined diff, you will never see + and - together on the same line.

> I wonder if with sufficiently evil merge we can have a line that is
> added (changed) in some children, and removed in other, i.e. pluses
> and minuses combined.

The logic in combine-diff.c::dump_sline() was written in such a way to avoid such a confusing output.

Show 5 quoted lines
> Nb. we can put regexp here, not only stringification of regexp.
> i.e.
>
>                   [qr/[+ ]{$num_sign}/, "add"],
>                   [qr/[- ]{$num_sign}/, "rem"],
That would be a good change.
Show 6 quoted lines
>> Also don't we want to use "context" or something for the css class for the
>> context lines, instead of assuming that we won't want to paint it in any
>> special color?
>
> Right.  We use "diff" class without anything else for context, but probably
> it would be better to state this explicitly.
Previous: Jakub NarebskiNext: Jakub Narebski
Message 7 of 8 in “gitweb: change format_diff_line() to remove leading SP from $diff_class”
  1. 1/2 gitweb: change format_diff_line() to remove leading SP from $diff_classKato Kazuyoshi, Oct 17, 2011
  2. Junio C HamanoOct 17, 2011
  3. Kato KazuyoshiOct 17, 2011
  4. Jakub NarebskiOct 17, 2011
  5. Junio C HamanoOct 17, 2011
  6. Jakub NarebskiOct 17, 2011
  7. Junio C HamanoOct 17, 2011
  8. gitweb: Refactor diff body line classificationJakub Narebski, Oct 18, 2011

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.