git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Syntax highlighting for combined diff
@ 2006-10-21  0:35 Jakub Narebski
  2006-10-21  7:48 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2006-10-21  0:35 UTC (permalink / raw)
  To: git

Linus Torvalds wrote in "Re: VCS comparison table"

> And "gitweb" does consider the first parent special, since it shows diffs 
> against that one (although I've argued that it probably shouldn't, and 
> that there should be some way to show branches against arbitrary parents)

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Syntax highlighting for combined diff
  2006-10-21  0:35 [RFC] Syntax highlighting for combined diff Jakub Narebski
@ 2006-10-21  7:48 ` Junio C Hamano
  2006-10-21  8:49   ` Jakub Narebski
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2006-10-21  7:48 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> 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?

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Syntax highlighting for combined diff
  2006-10-21  7:48 ` Junio C Hamano
@ 2006-10-21  8:49   ` Jakub Narebski
  2006-10-21  9:41     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2006-10-21  8:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> 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?
> 
> 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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Syntax highlighting for combined diff
  2006-10-21  8:49   ` Jakub Narebski
@ 2006-10-21  9:41     ` Junio C Hamano
  2006-10-21 10:02       ` Jakub Narebski
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2006-10-21  9:41 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> 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?

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Syntax highlighting for combined diff
  2006-10-21  9:41     ` Junio C Hamano
@ 2006-10-21 10:02       ` Jakub Narebski
  2006-10-21 10:40         ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2006-10-21 10:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > 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?
> 
> 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().

I was asking both about combined diff format, and how it is colored
by git-diff --color, to add colored combined diff output to gitweb.

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

That's enough for me.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Syntax highlighting for combined diff
  2006-10-21 10:02       ` Jakub Narebski
@ 2006-10-21 10:40         ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2006-10-21 10:40 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> Junio C Hamano wrote:
>> Jakub Narebski <jnareb@gmail.com> writes:
>> 
>> > 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?
>> 
>> 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().
>
> I was asking both about combined diff format, and how it is colored
> by git-diff --color, to add colored combined diff output to gitweb.

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

> Any other ideas how combined commitdiff should look like in gitweb?

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-21 10:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-21  0:35 [RFC] Syntax highlighting for combined diff Jakub Narebski
2006-10-21  7:48 ` Junio C Hamano
2006-10-21  8:49   ` Jakub Narebski
2006-10-21  9:41     ` Junio C Hamano
2006-10-21 10:02       ` Jakub Narebski
2006-10-21 10:40         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).