{"thread":{"id":"24704","subject":"[PATCH] Userdiff patterns for C#","startedAt":"2010-08-11T01:09:21Z","lastAt":"2010-08-22T07:23:06Z","messageCount":5,"participants":["Petr Onderka","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"147711","messageId":"1281488961-5884-1-git-send-email-gsvick@gmail.com","threadId":"24704","inReplyTo":null,"subject":"[PATCH] Userdiff patterns for C#","fromName":"Petr Onderka","fromEmail":"gsvick@gmail.com","sentAt":"2010-08-11T01:09:21Z","receivedAt":"2010-08-11T01:09:21Z","isPatch":true,"sender":{"key":"gsvick@gmail.com","avatar":"https://avatars.githubusercontent.com/u/287848?v=4"},"body":"Add userdiff patterns for C#. This code is an improved version of\ncode by Adam Petaccia from 21 June 2009 mail to the list.\n\nSigned-off-by: Petr Onderka <gsvick@gmail.com>\n---\nI was looking how to properly set up hunk-headers for C# and found\na mail from Adam Petaccia to this list, that almost did what I wanted.\nIt was never included, so I improved it and I hope it can be added\nto the official repository now.\n\n t/t4018-diff-funcname.sh |    2 +-\n userdiff.c               |   16 ++++++++++++++++\n 2 files changed, 17 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\nindex 5b10e97..61de8a2 100755\n--- a/t/t4018-diff-funcname.sh\n+++ b/t/t4018-diff-funcname.sh\n@@ -32,7 +32,7 @@ EOF\n \n sed 's/beer\\\\/beer,\\\\/' < Beer.java > Beer-correct.java\n \n-builtin_patterns=\"bibtex cpp html java objc pascal php python ruby tex\"\n+builtin_patterns=\"bibtex cpp csharp html java objc pascal php python ruby tex\"\n for p in $builtin_patterns\n do\n \ttest_expect_success \"builtin $p pattern compiles\" '\ndiff --git a/userdiff.c b/userdiff.c\nindex c49cc1b..e552215 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -82,6 +82,22 @@ PATTERNS(\"cpp\",\n \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n \t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"\n \t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+PATTERNS(\"csharp\",\n+\t /* Keywords */\n+\t \"!^[ \\t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\\n\"\n+\t /* Methods and constructors */\n+\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n+\t /* Properties */\n+\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[@._[:alnum:]]+)[ \\t]*$\\n\"\n+\t /* Type definitions */\n+\t \"^[ \\t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \\t]+)*(class|enum|interface|struct)[ \\t]+.*)$\\n\"\n+\t /* Namespace */\n+\t \"^[ \\t]*(namespace[ \\t]+.*)$\",\n+\t /* -- */\n+\t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n+\t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n+\t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"\n+\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n { \"default\", NULL, -1, { NULL, 0 } },\n };\n #undef PATTERNS\n-- \n1.7.1.msysgit.0.10.g9ffa0\n"},{"id":"147821","messageId":"20100811193739.GC8106@coredump.intra.peff.net","threadId":"24704","inReplyTo":"1281488961-5884-1-git-send-email-gsvick@gmail.com","subject":"Re: [PATCH] Userdiff patterns for C#","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-08-11T19:37:39Z","receivedAt":"2010-08-11T19:37:39Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 11, 2010 at 01:09:21AM +0000, Petr Onderka wrote:\n\n> Add userdiff patterns for C#. This code is an improved version of\n> code by Adam Petaccia from 21 June 2009 mail to the list.\n> [...]\n>  t/t4018-diff-funcname.sh |    2 +-\n>  userdiff.c               |   16 ++++++++++++++++\n>  2 files changed, 17 insertions(+), 1 deletions(-)\n\nCan you also add a line in Documentation/gitattributes.txt so that\npeople know your pattern is there? In the \"custom hunk-header\"\nsection, there is already a list to add to.\n\n-Peff\n"},{"id":"148193","messageId":"1281978062-5772-1-git-send-email-gsvick@gmail.com","threadId":"24704","inReplyTo":"20100811193739.GC8106@coredump.intra.peff.net","subject":"[PATCH v2] Userdiff patterns for C#","fromName":"Petr Onderka","fromEmail":"gsvick@gmail.com","sentAt":"2010-08-16T17:01:02Z","receivedAt":"2010-08-16T17:01:02Z","isPatch":true,"sender":{"key":"gsvick@gmail.com","avatar":"https://avatars.githubusercontent.com/u/287848?v=4"},"body":"Add userdiff patterns for C#. This code is an improved version of\ncode by Adam Petaccia from 21 June 2009 mail to the list.\n\nSigned-off-by: Petr Onderka <gsvick@gmail.com>\n---\nAdded the documentation.\n\n Documentation/gitattributes.txt |    2 ++\n t/t4018-diff-funcname.sh        |    2 +-\n userdiff.c                      |   16 ++++++++++++++++\n 3 files changed, 19 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 564586b..2e2370c 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -441,6 +441,8 @@ patterns are available:\n \n - `cpp` suitable for source code in the C and C++ languages.\n \n+- `csharp` suitable for source code in the C# language.\n+\n - `html` suitable for HTML/XHTML documents.\n \n - `java` suitable for source code in the Java language.\ndiff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\nindex 5b10e97..61de8a2 100755\n--- a/t/t4018-diff-funcname.sh\n+++ b/t/t4018-diff-funcname.sh\n@@ -32,7 +32,7 @@ EOF\n \n sed 's/beer\\\\/beer,\\\\/' < Beer.java > Beer-correct.java\n \n-builtin_patterns=\"bibtex cpp html java objc pascal php python ruby tex\"\n+builtin_patterns=\"bibtex cpp csharp html java objc pascal php python ruby tex\"\n for p in $builtin_patterns\n do\n \ttest_expect_success \"builtin $p pattern compiles\" '\ndiff --git a/userdiff.c b/userdiff.c\nindex c49cc1b..e552215 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -82,6 +82,22 @@ PATTERNS(\"cpp\",\n \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n \t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"\n \t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+PATTERNS(\"csharp\",\n+\t /* Keywords */\n+\t \"!^[ \\t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\\n\"\n+\t /* Methods and constructors */\n+\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n+\t /* Properties */\n+\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[@._[:alnum:]]+)[ \\t]*$\\n\"\n+\t /* Type definitions */\n+\t \"^[ \\t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \\t]+)*(class|enum|interface|struct)[ \\t]+.*)$\\n\"\n+\t /* Namespace */\n+\t \"^[ \\t]*(namespace[ \\t]+.*)$\",\n+\t /* -- */\n+\t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n+\t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n+\t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"\n+\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n { \"default\", NULL, -1, { NULL, 0 } },\n };\n #undef PATTERNS\n-- \n1.7.2.1.2358.g07fa\n"},{"id":"148194","messageId":"20100816171408.GA15815@coredump.intra.peff.net","threadId":"24704","inReplyTo":"1281978062-5772-1-git-send-email-gsvick@gmail.com","subject":"Re: [PATCH v2] Userdiff patterns for C#","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-08-16T17:14:08Z","receivedAt":"2010-08-16T17:14:08Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 16, 2010 at 05:01:02PM +0000, Petr Onderka wrote:\n\n> Add userdiff patterns for C#. This code is an improved version of\n> code by Adam Petaccia from 21 June 2009 mail to the list.\n> \n> Signed-off-by: Petr Onderka <gsvick@gmail.com>\n> ---\n> Added the documentation.\n\nThanks. I ran a few diffs on what little C# code I have, and it did seem\nto be an improvement. So:\n\nAcked-by: Jeff King <peff@peff.net>\n\n-Peff\n"},{"id":"148697","messageId":"7v7hjj6rhh.fsf@alter.siamese.dyndns.org","threadId":"24704","inReplyTo":"20100816171408.GA15815@coredump.intra.peff.net","subject":"Re: [PATCH v2] Userdiff patterns for C#","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-22T07:23:06Z","receivedAt":"2010-08-22T07:23:06Z","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> Thanks. I ran a few diffs on what little C# code I have, and it did seem\n> to be an improvement. So:\n>\n> Acked-by: Jeff King <peff@peff.net>\n\nThanks, both.\n"}]}