{"thread":{"id":"28221","subject":"[PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","startedAt":"2011-08-25T22:37:03Z","lastAt":"2011-08-29T22:43:16Z","messageCount":10,"participants":["Boaz Harrosh","Linus Torvalds","Junio C Hamano","Peter Zijlstra"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"174282","messageId":"4E56CE8F.8080501@panasas.com","threadId":"28221","inReplyTo":null,"subject":"[PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Boaz Harrosh","fromEmail":"bharrosh@panasas.com","sentAt":"2011-08-25T22:37:03Z","receivedAt":"2011-08-25T22:37:03Z","isPatch":true,"sender":{"key":"bharrosh@panasas.com","avatar":"https://gravatar.com/avatar/347e426f8ca0409f6891ceeefd4c3c2d8769608382323057efeaa362b4c3dbf3?d=mp&s=160"},"body":"\nThe Linux Kernel source tree is certainly a C language repository.\nAs a maintainer and code reviewer I would like too, for example:\nSee function names as hunk headers and not goto labels. And all\nthe other goodies a language specific diff parser gives me.\n\nAdd a .gitattributes file to the Linux tree to enable cpp parsing\nof the source files.\n\nPeople are welcome to add other parsers for other type of files\nif needed. (Like Makefile or Kconfig ...)\n\nCC: Jeff King <peff@peff.net>\nCC: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Boaz Harrosh <bharrosh@panasas.com>\n---\n .gitattributes |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n create mode 100644 .gitattributes\n\ndiff --git a/.gitattributes b/.gitattributes\nnew file mode 100644\nindex 0000000..6d2b620\n--- /dev/null\n+++ b/.gitattributes\n@@ -0,0 +1,2 @@\n+*.h diff=cpp\n+*.c diff=cpp\n-- \n1.7.6\n"},{"id":"174344","messageId":"CA+55aFxNXK-AJdrHBBycM5W632qUBi4E=jangcdRoefQiHzbug@mail.gmail.com","threadId":"28221","inReplyTo":"4E56CE8F.8080501@panasas.com","subject":"Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2011-08-26T20:27:43Z","receivedAt":"2011-08-26T20:27:43Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Thu, Aug 25, 2011 at 3:37 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:\n>\n> Add a .gitattributes file to the Linux tree to enable cpp parsing\n> of the source files.\n\nHmm. I'm not entirely conviced. If people really think that the hunk\ndescription matters that much, maybe we should just instead improve on\nthe automatic diff detection, and extend it from just binary-vs-text,\nto also do the common hunk-headers.\n\nAfter all, not having a diff pattern already *does* mean \"automatic\",\nso it would be just a rather trivial extension to that.\n\nJunio?\n\n                     Linus\n"},{"id":"174345","messageId":"7vfwkndhc4.fsf@alter.siamese.dyndns.org","threadId":"28221","inReplyTo":"CA+55aFxNXK-AJdrHBBycM5W632qUBi4E=jangcdRoefQiHzbug@mail.gmail.com","subject":"Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-26T20:54:19Z","receivedAt":"2011-08-26T20:54:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> On Thu, Aug 25, 2011 at 3:37 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:\n>>\n>> Add a .gitattributes file to the Linux tree to enable cpp parsing\n>> of the source files.\n>\n> Hmm. I'm not entirely conviced. If people really think that the hunk\n> description matters that much, maybe we should just instead improve on\n> the automatic diff detection, and extend it from just binary-vs-text,\n> to also do the common hunk-headers.\n>\n> After all, not having a diff pattern already *does* mean \"automatic\",\n> so it would be just a rather trivial extension to that.\n\nNot quite sure what you exactly mean by \"extend it from just binary-vs-text\".\nDo you mean update buffer_is_binary() and add source language detection?\n\nSee also:\n\n    http://thread.gmane.org/gmane.comp.version-control.git/180103/focus=180113\n"},{"id":"174346","messageId":"4E580830.4010305@panasas.com","threadId":"28221","inReplyTo":"CA+55aFxNXK-AJdrHBBycM5W632qUBi4E=jangcdRoefQiHzbug@mail.gmail.com","subject":"Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Boaz Harrosh","fromEmail":"bharrosh@panasas.com","sentAt":"2011-08-26T20:55:12Z","receivedAt":"2011-08-26T20:55:12Z","isPatch":true,"sender":{"key":"bharrosh@panasas.com","avatar":"https://gravatar.com/avatar/347e426f8ca0409f6891ceeefd4c3c2d8769608382323057efeaa362b4c3dbf3?d=mp&s=160"},"body":"On 08/26/2011 01:27 PM, Linus Torvalds wrote:\n> On Thu, Aug 25, 2011 at 3:37 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:\n>>\n>> Add a .gitattributes file to the Linux tree to enable cpp parsing\n>> of the source files.\n> \n> Hmm. I'm not entirely conviced. If people really think that the hunk\n> description matters that much, maybe we should just instead improve on\n> the automatic diff detection, and extend it from just binary-vs-text,\n> to also do the common hunk-headers.\n> \n> After all, not having a diff pattern already *does* mean \"automatic\",\n> so it would be just a rather trivial extension to that.\n> \n> Junio?\n> \n\nThere was a patch submitted for new git version to auto detect file\nextensions and do the right thing. \n(Look for the thread \"git diff annoyance / feature request\" on the git\n mailing list)\n\nBut this patch is for all the people and distributions that are going\nto use the old git versions for a while, (Years).\n\nIt is important for the Linux mailing-list review, because you get\npatches with:\n\n@@@ lable out:\n-\tchange foo\n+\tto bazz\n\nAnd how the hell are you suppose to know where in the file it is.\nThis is such a trivial addition, that can help unify everyone's\nusage. I don't see the down sides.\n\nThanks\nBoaz\n\n>                      Linus\n"},{"id":"174348","messageId":"CA+55aFy=T82q==OxAzRfUgyfzMvy7=oeLOEAL8=rTJWOwkw-iA@mail.gmail.com","threadId":"28221","inReplyTo":"7vfwkndhc4.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2011-08-26T20:59:35Z","receivedAt":"2011-08-26T20:59:35Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Fri, Aug 26, 2011 at 1:54 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Not quite sure what you exactly mean by \"extend it from just binary-vs-text\".\n> Do you mean update buffer_is_binary() and add source language detection?\n\nYes. Except the \"detection\" would be just \"if we auto-detect it as\ntext, then use the standard file extensions to also make an automatic\nhunk rule detection\".\n\nSo it would do the most common cases (*.[Cch] etc)\n\n                         Linus\n"},{"id":"174456","messageId":"1314624752.2816.32.camel@twins","threadId":"28221","inReplyTo":"4E580830.4010305@panasas.com","subject":"Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Peter Zijlstra","fromEmail":"peterz@infradead.org","sentAt":"2011-08-29T13:32:32Z","receivedAt":"2011-08-29T13:32:32Z","isPatch":true,"sender":{"key":"peterz@infradead.org","avatar":null},"body":"On Fri, 2011-08-26 at 13:55 -0700, Boaz Harrosh wrote:\n\n> But this patch is for all the people and distributions that are going\n> to use the old git versions for a while, (Years).\n> \n> It is important for the Linux mailing-list review, because you get\n> patches with:\n> \n> @@@ lable out:\n> -\tchange foo\n> +\tto bazz\n> \n> And how the hell are you suppose to know where in the file it is.\n> This is such a trivial addition, that can help unify everyone's\n> usage. I don't see the down sides.\n\nAh, I'm using:\n\n# cat ~/.gitconfig \n[diff \"default\"]\n                xfuncname = \"^[[:alpha:]$_].*[^:]$\"\n\n\nFor this.\n"},{"id":"174497","messageId":"4E5BFD36.2090000@panasas.com","threadId":"28221","inReplyTo":"1314624752.2816.32.camel@twins","subject":"Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Boaz Harrosh","fromEmail":"bharrosh@panasas.com","sentAt":"2011-08-29T20:57:26Z","receivedAt":"2011-08-29T20:57:26Z","isPatch":true,"sender":{"key":"bharrosh@panasas.com","avatar":"https://gravatar.com/avatar/347e426f8ca0409f6891ceeefd4c3c2d8769608382323057efeaa362b4c3dbf3?d=mp&s=160"},"body":"On 08/29/2011 06:32 AM, Peter Zijlstra wrote:\n> On Fri, 2011-08-26 at 13:55 -0700, Boaz Harrosh wrote:\n> \n>> But this patch is for all the people and distributions that are going\n>> to use the old git versions for a while, (Years).\n>>\n>> It is important for the Linux mailing-list review, because you get\n>> patches with:\n>>\n>> @@@ lable out:\n>> -\tchange foo\n>> +\tto bazz\n>>\n>> And how the hell are you suppose to know where in the file it is.\n>> This is such a trivial addition, that can help unify everyone's\n>> usage. I don't see the down sides.\n> \n> Ah, I'm using:\n> \n> # cat ~/.gitconfig \n> [diff \"default\"]\n>                 xfuncname = \"^[[:alpha:]$_].*[^:]$\"\n> \n> \n> For this.\n\nIt looks like a lost cause so I'll try for the last time.\n\nEveryone is suggesting that each one do his own cooked up secrets and solutions.\nAnd those that are stupid and know nothing like me are un-lucky. But what I'm\nproposing is that by just doing a \"git clone\" you'll be using these settings\nthat we like to see, when you send us your patches.\n\nAdding a .gitattributes file to the Linux git tree is a very simple message.\n\"In the linux git tree all .c and .h files are c-source files\" (And git will\ntreat them that way)\n\nNow that was not so hard was it? Really, no one said anything bad or negative\nabout the patch, only excuses how it can be achieved, very difficultly, in\nanother way. So for the last time:\n  What are you guys afraid of? what possibly could be bad about this patch?\n\nSigh\n\nGood bye to this subject\nBoaz\n"},{"id":"174503","messageId":"1314653414.2054.0.camel@twins","threadId":"28221","inReplyTo":"4E5BFD36.2090000@panasas.com","subject":"Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Peter Zijlstra","fromEmail":"peterz@infradead.org","sentAt":"2011-08-29T21:30:14Z","receivedAt":"2011-08-29T21:30:14Z","isPatch":true,"sender":{"key":"peterz@infradead.org","avatar":null},"body":"On Mon, 2011-08-29 at 13:57 -0700, Boaz Harrosh wrote:\n> \n> Adding a .gitattributes file to the Linux git tree is a very simple message.\n> \"In the linux git tree all .c and .h files are c-source files\" (And git will\n> treat them that way) \n\nI'm all for it, I hate those labels in git-diff output.. \n"},{"id":"174511","messageId":"CA+55aFxB7mBByT9W4c0D6kELcZMZDD_j0_S2869nS4LV0mNTbA@mail.gmail.com","threadId":"28221","inReplyTo":"4E5BFD36.2090000@panasas.com","subject":"Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2011-08-29T22:02:35Z","receivedAt":"2011-08-29T22:02:35Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Mon, Aug 29, 2011 at 1:57 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:\n>\n>  What are you guys afraid of? what possibly could be bad about this patch?\n\nI just detest filling the kernel tree with git stuff.\n\nRight now, the only git-specific file we have in the kernel tree is\nthe \".gitignore\" files, afaik. And if you were to use some other SCM,\nthe \"ignore\" model at least translates directly to just about anything\nelse (with the problem that the .gitignore model tends to be more\npowerful than most other SCM's have, but whatever).\n\nI'd hate to start populating the project with more stuff.\n\n                     Linus\n"},{"id":"174518","messageId":"4E5C1604.2060209@panasas.com","threadId":"28221","inReplyTo":"CA+55aFxB7mBByT9W4c0D6kELcZMZDD_j0_S2869nS4LV0mNTbA@mail.gmail.com","subject":"Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files","fromName":"Boaz Harrosh","fromEmail":"bharrosh@panasas.com","sentAt":"2011-08-29T22:43:16Z","receivedAt":"2011-08-29T22:43:16Z","isPatch":true,"sender":{"key":"bharrosh@panasas.com","avatar":"https://gravatar.com/avatar/347e426f8ca0409f6891ceeefd4c3c2d8769608382323057efeaa362b4c3dbf3?d=mp&s=160"},"body":"On 08/29/2011 03:02 PM, Linus Torvalds wrote:\n> \n> I'd hate to start populating the project with more stuff.\n> \n>                      Linus\n\nOK Thanks for the answer. That I can understand\nBoaz\n"}]}