{"thread":{"id":"27976","subject":"[PATCH 0/2] Minor userdiff stuff","startedAt":"2011-08-01T10:37:47Z","lastAt":"2011-08-03T18:53:50Z","messageCount":9,"participants":["Giuseppe Bilotta","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"172516","messageId":"1312195069-10782-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"27976","inReplyTo":null,"subject":"[PATCH 0/2] Minor userdiff stuff","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2011-08-01T10:37:47Z","receivedAt":"2011-08-01T10:37:47Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"The first commit introduces diff patterns for POSIX shells.\n\nThe second defines diff types for C, Perl and shell scripts in git.git\n\nGiuseppe Bilotta (2):\n  Diff patterns for POSIX shells\n  Use specific diff rules for repo files\n\n .gitattributes |    5 +++--\n userdiff.c     |    3 +++\n 2 files changed, 6 insertions(+), 2 deletions(-)\n\n-- \n1.7.6.451.gcb935.dirty\n"},{"id":"172517","messageId":"1312195069-10782-2-git-send-email-giuseppe.bilotta@gmail.com","threadId":"27976","inReplyTo":"1312195069-10782-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 1/2] Diff patterns for POSIX shells","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2011-08-01T10:37:48Z","receivedAt":"2011-08-01T10:37:48Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"All diffs following a function definition will have that function name\nas chunck header, but this is the best we can do with the current\nuserdiff capabilities.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n userdiff.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/userdiff.c b/userdiff.c\nindex 01d3a8b..70120c3 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -107,6 +107,9 @@\n \t \"(@|@@|\\\\$)?[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\\\?(\\\\\\\\C-)?(\\\\\\\\M-)?.\"\n \t \"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\\\.{1,3}|::|[!=]~\"),\n+PATTERNS(\"shell\", \"^[ \\t]*([a-zA-Z_0-9]+)[ \\t]*\\\\(\\\\).*\",\n+\t /* -- */\n+\t \"(--|\\\\$)?[a-zA-Z_0-9]+|&&|\\\\|\\\\|\"),\n PATTERNS(\"bibtex\", \"(@[a-zA-Z]{1,}[ \\t]*\\\\{{0,1}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*).*$\",\n \t \"[={}\\\"]|[^={}\\\" \\t]+\"),\n PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n-- \n1.7.6.451.gcb935.dirty\n"},{"id":"172518","messageId":"1312195069-10782-3-git-send-email-giuseppe.bilotta@gmail.com","threadId":"27976","inReplyTo":"1312195069-10782-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 2/2] Use specific diff rules for repo files","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2011-08-01T10:37:49Z","receivedAt":"2011-08-01T10:37:49Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Let's eat our own dogfood. (Also, this makes word diff much nicer on\ngit's own repo.)\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n .gitattributes |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/.gitattributes b/.gitattributes\nindex 5e98806..16930e6 100644\n--- a/.gitattributes\n+++ b/.gitattributes\n@@ -1,3 +1,4 @@\n * whitespace=!indent,trail,space\n-*.[ch] whitespace=indent,trail,space\n-*.sh whitespace=indent,trail,space\n+*.[ch] whitespace=indent,trail,space diff=cpp\n+*.sh whitespace=indent,trail,space diff=shell\n+*.perl diff=perl\n-- \n1.7.6.451.gcb935.dirty\n"},{"id":"172677","messageId":"7vzkjrem6b.fsf@alter.siamese.dyndns.org","threadId":"27976","inReplyTo":"1312195069-10782-2-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH 1/2] Diff patterns for POSIX shells","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-02T17:51:56Z","receivedAt":"2011-08-02T17:51:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:\n\n> All diffs following a function definition will have that function name\n> as chunck header, but this is the best we can do with the current\n> userdiff capabilities.\n>\n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  userdiff.c |    3 +++\n>  1 files changed, 3 insertions(+), 0 deletions(-)\n>\n> diff --git a/userdiff.c b/userdiff.c\n> index 01d3a8b..70120c3 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -107,6 +107,9 @@\n>  \t \"(@|@@|\\\\$)?[a-zA-Z_][a-zA-Z0-9_]*\"\n>  \t \"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\\\?(\\\\\\\\C-)?(\\\\\\\\M-)?.\"\n>  \t \"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\\\.{1,3}|::|[!=]~\"),\n> +PATTERNS(\"shell\", \"^[ \\t]*([a-zA-Z_0-9]+)[ \\t]*\\\\(\\\\).*\",\n> +\t /* -- */\n> +\t \"(--|\\\\$)?[a-zA-Z_0-9]+|&&|\\\\|\\\\|\"),\n\nHmm, what is this \"double-dash -- might be present before a name\" about?\n\n>  PATTERNS(\"bibtex\", \"(@[a-zA-Z]{1,}[ \\t]*\\\\{{0,1}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*).*$\",\n>  \t \"[={}\\\"]|[^={}\\\" \\t]+\"),\n>  PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n"},{"id":"172685","messageId":"CAOxFTcy-AXtCW7-BCLgYnNTGd+unkiSaWAGPO+k+fcKr5VK-mw@mail.gmail.com","threadId":"27976","inReplyTo":"7vzkjrem6b.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] Diff patterns for POSIX shells","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2011-08-02T18:52:58Z","receivedAt":"2011-08-02T18:52:58Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Tue, Aug 2, 2011 at 7:51 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:\n>\n>> All diffs following a function definition will have that function name\n>> as chunck header, but this is the best we can do with the current\n>> userdiff capabilities.\n>>\n>> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n>> ---\n>>  userdiff.c |    3 +++\n>>  1 files changed, 3 insertions(+), 0 deletions(-)\n>>\n>> diff --git a/userdiff.c b/userdiff.c\n>> index 01d3a8b..70120c3 100644\n>> --- a/userdiff.c\n>> +++ b/userdiff.c\n>> @@ -107,6 +107,9 @@\n>>        \"(@|@@|\\\\$)?[a-zA-Z_][a-zA-Z0-9_]*\"\n>>        \"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\\\?(\\\\\\\\C-)?(\\\\\\\\M-)?.\"\n>>        \"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\\\.{1,3}|::|[!=]~\"),\n>> +PATTERNS(\"shell\", \"^[ \\t]*([a-zA-Z_0-9]+)[ \\t]*\\\\(\\\\).*\",\n>> +      /* -- */\n>> +      \"(--|\\\\$)?[a-zA-Z_0-9]+|&&|\\\\|\\\\|\"),\n>\n> Hmm, what is this \"double-dash -- might be present before a name\" about?\n>\n\nNow that's a good question. I think it was a brainfart while testing\nthe regexp; came across a case switch where the candidate were\noptions, and somehow decided that it was better to include the --.\nI'll prepare a patch without this stupidity.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"172728","messageId":"1312349176-20984-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"27976","inReplyTo":"7vzkjrem6b.fsf@alter.siamese.dyndns.org","subject":"[PATCH 1bis/2] Diff patterns for POSIX shells","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2011-08-03T05:26:16Z","receivedAt":"2011-08-03T05:26:16Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"All diffs following a function definition will have that function name\nas chunck header, but this is the best we can do with the current\nuserdiff capabilities.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n userdiff.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/userdiff.c b/userdiff.c\nindex 01d3a8b..94b1c47 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -107,6 +107,9 @@\n \t \"(@|@@|\\\\$)?[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\\\?(\\\\\\\\C-)?(\\\\\\\\M-)?.\"\n \t \"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\\\.{1,3}|::|[!=]~\"),\n+PATTERNS(\"shell\", \"^[ \\t]*([a-zA-Z_0-9]+)[ \\t]*\\\\(\\\\).*\",\n+\t /* -- */\n+\t \"\\\\$?[a-zA-Z_0-9]+|&&|\\\\|\\\\|\"),\n PATTERNS(\"bibtex\", \"(@[a-zA-Z]{1,}[ \\t]*\\\\{{0,1}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*).*$\",\n \t \"[={}\\\"]|[^={}\\\" \\t]+\"),\n PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n-- \n1.7.6.485.gd947c.dirty\n"},{"id":"172738","messageId":"20110803093252.GA16351@sigill.intra.peff.net","threadId":"27976","inReplyTo":"1312349176-20984-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH 1bis/2] Diff patterns for POSIX shells","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-08-03T09:32:52Z","receivedAt":"2011-08-03T09:32:52Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 03, 2011 at 07:26:16AM +0200, Giuseppe Bilotta wrote:\n\n> All diffs following a function definition will have that function name\n> as chunck header, but this is the best we can do with the current\n> userdiff capabilities.\n\nCurious as to how this would look in git.git, I tried \"git log -p\"\nbefore and after your patches, and diffed the result. I noticed two\nthings:\n\n  1. Given a block of shell code like this:\n\n        foo() {\n          ... do something ...\n        }\n\n        test_expect_success 'test foo' '\n          ... the actual test ...\n        '\n\n     if we add new code after the test, the old regex would print:\n\n        @@ -1,2 +3,4 @@ test_expect_success 'test foo' '\n\n     and now we say:\n\n        @@ -1,2 +3,4 @@ foo\n\n     which seems more misleading. I know the function-matching code has\n     no way to say \"look for ^}, which signals end of function\", so we\n     can't be entirely accurate. But I wonder if the new heuristic\n     (which seems to look for a name followed by parentheses) is\n     actually any better than the old.\n\n  2. What would have printed before:\n\n       @@ -1,2 +3,4 @@ foo() {\n\n     now prints\n\n       @@ -1,2 +3,4 @@ foo\n\n     without the parentheses or brace. It looks like the similar C one\n     keeps the parentheses, at least. I find that a bit more readable,\n     as it is more clear that the line indicates a function, and not\n     simply some top-level command.\n\n-Peff\n"},{"id":"172743","messageId":"CAOxFTcxEL38HW0mX++Wa7b0TEPo56xDZPZaqJ5wrpMcQGSfQoQ@mail.gmail.com","threadId":"27976","inReplyTo":"20110803093252.GA16351@sigill.intra.peff.net","subject":"Re: [PATCH 1bis/2] Diff patterns for POSIX shells","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2011-08-03T10:12:41Z","receivedAt":"2011-08-03T10:12:41Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Wed, Aug 3, 2011 at 11:32 AM, Jeff King <peff@peff.net> wrote:\n> On Wed, Aug 03, 2011 at 07:26:16AM +0200, Giuseppe Bilotta wrote:\n>\n>> All diffs following a function definition will have that function name\n>> as chunck header, but this is the best we can do with the current\n>> userdiff capabilities.\n>\n> Curious as to how this would look in git.git, I tried \"git log -p\"\n> before and after your patches, and diffed the result. I noticed two\n> things:\n>\n>  1. Given a block of shell code like this:\n>\n>        foo() {\n>          ... do something ...\n>        }\n>\n>        test_expect_success 'test foo' '\n>          ... the actual test ...\n>        '\n>\n>     if we add new code after the test, the old regex would print:\n>\n>        @@ -1,2 +3,4 @@ test_expect_success 'test foo' '\n>\n>     and now we say:\n>\n>        @@ -1,2 +3,4 @@ foo\n>\n>     which seems more misleading. I know the function-matching code has\n>     no way to say \"look for ^}, which signals end of function\", so we\n>     can't be entirely accurate. But I wonder if the new heuristic\n>     (which seems to look for a name followed by parentheses) is\n>     actually any better than the old.\n\nI'm not too satisfied with the solution either. I've been thinking\nabout adding some important keywords such as for, while, if, until,\ncase etc, but decided it would be too much overkill. And, it still\nwoudln't work 'correctly' in a case such as this one you presented\nabove.\n\n>  2. What would have printed before:\n>\n>       @@ -1,2 +3,4 @@ foo() {\n>\n>     now prints\n>\n>       @@ -1,2 +3,4 @@ foo\n>\n>     without the parentheses or brace. It looks like the similar C one\n>     keeps the parentheses, at least. I find that a bit more readable,\n>     as it is more clear that the line indicates a function, and not\n>     simply some top-level command.\n\nIndeed. I'll change the regexp to include the parenthesis.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"172791","messageId":"7vmxfqba2p.fsf@alter.siamese.dyndns.org","threadId":"27976","inReplyTo":"20110803093252.GA16351@sigill.intra.peff.net","subject":"Re: [PATCH 1bis/2] Diff patterns for POSIX shells","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-03T18:53:50Z","receivedAt":"2011-08-03T18:53:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Wed, Aug 03, 2011 at 07:26:16AM +0200, Giuseppe Bilotta wrote:\n>\n>> All diffs following a function definition will have that function name\n>> as chunck header, but this is the best we can do with the current\n>> userdiff capabilities.\n>\n> Curious as to how this would look in git.git, I tried \"git log -p\"\n> before and after your patches, and diffed the result. I noticed two\n> things:\n\nHmm, sounds like a regression without much upside to me.\nThanks for looking.\n"}]}