Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:17

Jakub Narebski [off-list ref] writes:
O.K.
quoted
                [" {$num_sign}", ""],
O.K.
quoted
                ["[+ ]{$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.
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.
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help