Re: [RFC] Syntax highlighting for combined diff

Previous thread: Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle by Jakub Narebski on Friday, October 20, 2006 - 4:24 pm. (2 messages)

Next thread: [PATCH] make cg-commit --review restore original tree state afterwards by Sam Vilain on Friday, October 20, 2006 - 6:11 pm. (3 messages)
From: Jakub Narebski
Date: Friday, October 20, 2006 - 5:35 pm

So the question is how to color combined diff format (what should be syntax
highlighting for combined diff format). If branches columns have only
pluses we use the same color as for adding line in ordinary diff; if
branches column consist only of minuses we use the same color as for
removing line in ordinary diff. Can there be mixture of plusses and
minuses? How git-diff --color solves this?

Should we in gitweb output change color slightly depending on number of
plusses or minuses?
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


-

From: Junio C Hamano
Date: Saturday, October 21, 2006 - 12:48 am

UTSL ;-).

Otherwise (iow, if you refuse to use the source), you could
cheat and let "git diff" do the coloring for you, and then
regexp replace the output.  You could even use the same coloring
logic for normal diff if you did so.




-

From: Jakub Narebski
Date: Saturday, October 21, 2006 - 1:49 am

Do I understand code correctly, and the last '+' or '-'
in the parents column means?

        for (i = 0; i < ecbdata->nparents && len; i++) {
                if (line[i] == '-')
                        color = DIFF_FILE_OLD;
                else if (line[i] == '+')
                        color = DIFF_FILE_NEW;
        }

Anyone who wrote this code, could you answer me, please?
-- 
Jakub Narebski
Poland
-

From: Junio C Hamano
Date: Saturday, October 21, 2006 - 2:41 am

The "up to ecbdata->nparents" is Johannes in cd112ce.  But you
are looking at a wrong code, I am afraid, if your original
question was about the combined format (there is a comment about
the codepath dealing only with two-way diffs by Johannes, above
the part you quoted).  The output for combined diff is coming
from combine-diff.c:dump_sline().

Combined diff output logic pretty much guarantees that you never
will see plus and minus on the same line.


-

From: Jakub Narebski
Date: Saturday, October 21, 2006 - 3:02 am

I was asking both about combined diff format, and how it is colored

That's enough for me.

Any other ideas how combined commitdiff should look like in gitweb?
-- 
Jakub Narebski
Poland
-

From: Junio C Hamano
Date: Saturday, October 21, 2006 - 3:40 am

I was answering about both.  dump_sline() implements both format

Combined or no combined, one thing that mildly irritates me
sometimes is that there does not seem to be an easy and obvious
way to do a rough equivalent of typing SPACE repeatedly while
viewing "git log -p".

In other words, I think it would be a nice addition to have "go
to commitdiff page of this parent" links near the top on the
commitdiff page.



-

Previous thread: Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle by Jakub Narebski on Friday, October 20, 2006 - 4:24 pm. (2 messages)

Next thread: [PATCH] make cg-commit --review restore original tree state afterwards by Sam Vilain on Friday, October 20, 2006 - 6:11 pm. (3 messages)