{"thread":{"id":"5976","subject":"[RFC] Syntax highlighting for combined diff","startedAt":"2006-10-21T00:35:41Z","lastAt":"2006-10-21T10:40:43Z","messageCount":6,"participants":["Jakub Narebski","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"29449","messageId":"ehbq0k$24l$1@sea.gmane.org","threadId":"5976","inReplyTo":null,"subject":"[RFC] Syntax highlighting for combined diff","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-21T00:35:41Z","receivedAt":"2006-10-21T00:35:41Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Linus Torvalds wrote in \"Re: VCS comparison table\"\n\n> And \"gitweb\" does consider the first parent special, since it shows diffs \n> against that one (although I've argued that it probably shouldn't, and \n> that there should be some way to show branches against arbitrary parents)\n\nSo the question is how to color combined diff format (what should be syntax\nhighlighting for combined diff format). If branches columns have only\npluses we use the same color as for adding line in ordinary diff; if\nbranches column consist only of minuses we use the same color as for\nremoving line in ordinary diff. Can there be mixture of plusses and\nminuses? How git-diff --color solves this?\n\nShould we in gitweb output change color slightly depending on number of\nplusses or minuses?\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"29471","messageId":"7vslhigld7.fsf@assigned-by-dhcp.cox.net","threadId":"5976","inReplyTo":"ehbq0k$24l$1@sea.gmane.org","subject":"Re: [RFC] Syntax highlighting for combined diff","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-21T07:48:36Z","receivedAt":"2006-10-21T07:48:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> So the question is how to color combined diff format (what should be syntax\n> highlighting for combined diff format). If branches columns have only\n> pluses we use the same color as for adding line in ordinary diff; if\n> branches column consist only of minuses we use the same color as for\n> removing line in ordinary diff. Can there be mixture of plusses and\n> minuses? How git-diff --color solves this?\n\nUTSL ;-).\n\nOtherwise (iow, if you refuse to use the source), you could\ncheat and let \"git diff\" do the coloring for you, and then\nregexp replace the output.  You could even use the same coloring\nlogic for normal diff if you did so.\n"},{"id":"29477","messageId":"200610211049.56477.jnareb@gmail.com","threadId":"5976","inReplyTo":"7vslhigld7.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFC] Syntax highlighting for combined diff","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-21T08:49:56Z","receivedAt":"2006-10-21T08:49:56Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n>> So the question is how to color combined diff format (what should be syntax\n>> highlighting for combined diff format). If branches columns have only\n>> pluses we use the same color as for adding line in ordinary diff; if\n>> branches column consist only of minuses we use the same color as for\n>> removing line in ordinary diff. Can there be mixture of plusses and\n>> minuses? How git-diff --color solves this?\n> \n> UTSL ;-).\n> \n> Otherwise (iow, if you refuse to use the source), you could\n> cheat and let \"git diff\" do the coloring for you, and then\n> regexp replace the output.  You could even use the same coloring\n> logic for normal diff if you did so.\n\nDo I understand code correctly, and the last '+' or '-'\nin the parents column means?\n\n        for (i = 0; i < ecbdata->nparents && len; i++) {\n                if (line[i] == '-')\n                        color = DIFF_FILE_OLD;\n                else if (line[i] == '+')\n                        color = DIFF_FILE_NEW;\n        }\n\nAnyone who wrote this code, could you answer me, please?\n-- \nJakub Narebski\nPoland\n"},{"id":"29480","messageId":"7vfydigg4w.fsf@assigned-by-dhcp.cox.net","threadId":"5976","inReplyTo":"200610211049.56477.jnareb@gmail.com","subject":"Re: [RFC] Syntax highlighting for combined diff","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-21T09:41:35Z","receivedAt":"2006-10-21T09:41:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Do I understand code correctly, and the last '+' or '-'\n> in the parents column means?\n>\n>         for (i = 0; i < ecbdata->nparents && len; i++) {\n>                 if (line[i] == '-')\n>                         color = DIFF_FILE_OLD;\n>                 else if (line[i] == '+')\n>                         color = DIFF_FILE_NEW;\n>         }\n>\n> Anyone who wrote this code, could you answer me, please?\n\nThe \"up to ecbdata->nparents\" is Johannes in cd112ce.  But you\nare looking at a wrong code, I am afraid, if your original\nquestion was about the combined format (there is a comment about\nthe codepath dealing only with two-way diffs by Johannes, above\nthe part you quoted).  The output for combined diff is coming\nfrom combine-diff.c:dump_sline().\n\nCombined diff output logic pretty much guarantees that you never\nwill see plus and minus on the same line.\n"},{"id":"29482","messageId":"200610211202.00314.jnareb@gmail.com","threadId":"5976","inReplyTo":"7vfydigg4w.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFC] Syntax highlighting for combined diff","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-21T10:02:00Z","receivedAt":"2006-10-21T10:02:00Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n> > Do I understand code correctly, and the last '+' or '-'\n> > in the parents column means?\n> >\n> >         for (i = 0; i < ecbdata->nparents && len; i++) {\n> >                 if (line[i] == '-')\n> >                         color = DIFF_FILE_OLD;\n> >                 else if (line[i] == '+')\n> >                         color = DIFF_FILE_NEW;\n> >         }\n> >\n> > Anyone who wrote this code, could you answer me, please?\n> \n> The \"up to ecbdata->nparents\" is Johannes in cd112ce.  But you\n> are looking at a wrong code, I am afraid, if your original\n> question was about the combined format (there is a comment about\n> the codepath dealing only with two-way diffs by Johannes, above\n> the part you quoted).  The output for combined diff is coming\n> from combine-diff.c:dump_sline().\n\nI was asking both about combined diff format, and how it is colored\nby git-diff --color, to add colored combined diff output to gitweb.\n\n> Combined diff output logic pretty much guarantees that you never\n> will see plus and minus on the same line.\n\nThat's enough for me.\n\nAny other ideas how combined commitdiff should look like in gitweb?\n-- \nJakub Narebski\nPoland\n"},{"id":"29485","messageId":"7v4ptygdec.fsf@assigned-by-dhcp.cox.net","threadId":"5976","inReplyTo":"200610211202.00314.jnareb@gmail.com","subject":"Re: [RFC] Syntax highlighting for combined diff","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-21T10:40:43Z","receivedAt":"2006-10-21T10:40:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>> Jakub Narebski <jnareb@gmail.com> writes:\n>> \n>> > Do I understand code correctly, and the last '+' or '-'\n>> > in the parents column means?\n>> >\n>> >         for (i = 0; i < ecbdata->nparents && len; i++) {\n>> >                 if (line[i] == '-')\n>> >                         color = DIFF_FILE_OLD;\n>> >                 else if (line[i] == '+')\n>> >                         color = DIFF_FILE_NEW;\n>> >         }\n>> >\n>> > Anyone who wrote this code, could you answer me, please?\n>> \n>> The \"up to ecbdata->nparents\" is Johannes in cd112ce.  But you\n>> are looking at a wrong code, I am afraid, if your original\n>> question was about the combined format (there is a comment about\n>> the codepath dealing only with two-way diffs by Johannes, above\n>> the part you quoted).  The output for combined diff is coming\n>> from combine-diff.c:dump_sline().\n>\n> I was asking both about combined diff format, and how it is colored\n> by git-diff --color, to add colored combined diff output to gitweb.\n\nI was answering about both.  dump_sline() implements both format\nand coloring.\n\n> Any other ideas how combined commitdiff should look like in gitweb?\n\nCombined or no combined, one thing that mildly irritates me\nsometimes is that there does not seem to be an easy and obvious\nway to do a rough equivalent of typing SPACE repeatedly while\nviewing \"git log -p\".\n\nIn other words, I think it would be a nice addition to have \"go\nto commitdiff page of this parent\" links near the top on the\ncommitdiff page.\n"}]}