All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Updated C# userdiff patterns.
@ 2014-04-25 23:25 Marius Ungureanu
  2014-04-26  7:10 ` Johannes Sixt
  0 siblings, 1 reply; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-25 23:25 UTC (permalink / raw)
  To: git

New keywords: foreach, break, in, try, finally, as, is, typeof, var,
default, fixed, checked, unchecked, this, lock, readonly, unsafe,
ref, out, base, null, delegate, continue.

Removed keywords: instanceof. It's only in Java.
Moved keywords to happen before modifier parsing, as matching a keyword
will stop modifiers from being matched.

Added method modifiers: extern, abstract.

Added properties modifiers: abstract.

Added parsing of events and delegates, which are like properties, but
take an extra keyword.

The reasoning behind adding unsafe to keywords is being also a
statement that can happen inline in code to mention blocks which are
unsafe. Also, delegates are not necessarily declared in class bodies,
but can also happen inline in other functions.

Keywords are based on MSDN docs.

Signed-off-by: Marius Ungureanu <marius.ungureanu@xamarin.com>
---
 userdiff.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/userdiff.c b/userdiff.c
index fad52d6..7612c5d 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -133,14 +133,14 @@ PATTERNS("cpp",
 	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*"
 	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
 PATTERNS("csharp",
-	 /* Keywords */
-	 "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
 	 /* Methods and constructors */
-	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
-	 /* Properties */
-	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
+	 "^[ \t]*(((abstract|extern|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
+	 /* Properties, events, delegates */
+	 "^[ \t]*(((abstract|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*((delegate|event)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
 	 /* Type definitions */
-	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
+	 "^[ \t]*(((abstract|internal|new|override|partial|private|protected|public|sealed|static|unsafe)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
+	 /* Keywords */
+	 "!^[ \t]*(as|base|break|case|catch|checked|continue|default|delegate|do|else|finally|fixed|for|foreach|if|in|is|lock|new|null|out|readonly|ref|return|switch|this|throw|try|typeof|unchecked|unsafe|using|var|while)\n"
 	 /* Namespace */
 	 "^[ \t]*(namespace[ \t]+.*)$",
 	 /* -- */
-- 
1.8.4

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

* Re: [PATCH] Updated C# userdiff patterns.
  2014-04-25 23:25 [PATCH] Updated C# userdiff patterns Marius Ungureanu
@ 2014-04-26  7:10 ` Johannes Sixt
  2014-04-26  9:55   ` Marius Ungureanu
  0 siblings, 1 reply; 16+ messages in thread
From: Johannes Sixt @ 2014-04-26  7:10 UTC (permalink / raw)
  To: Marius Ungureanu, git

Am 26.04.2014 01:25, schrieb Marius Ungureanu:
> New keywords: foreach, break, in, try, finally, as, is, typeof, var,
> default, fixed, checked, unchecked, this, lock, readonly, unsafe,
> ref, out, base, null, delegate, continue.
> 
> Removed keywords: instanceof. It's only in Java.
> Moved keywords to happen before modifier parsing, as matching a keyword
> will stop modifiers from being matched.
> 
> Added method modifiers: extern, abstract.
> 
> Added properties modifiers: abstract.
> 
> Added parsing of events and delegates, which are like properties, but
> take an extra keyword.
> 
> The reasoning behind adding unsafe to keywords is being also a
> statement that can happen inline in code to mention blocks which are
> unsafe. Also, delegates are not necessarily declared in class bodies,
> but can also happen inline in other functions.
> 
> Keywords are based on MSDN docs.
> 
> Signed-off-by: Marius Ungureanu <marius.ungureanu@xamarin.com>

Thanks for your contribution.

Please write the commit message in imperative mood, and use full
sentences, not just fragments and avoid contractions ("it's"). Also,
don't capitalize the subject line and drop the full-stop:

   update C# userdiff patterns

   Add new keywords: foreach, break, ...

   Remove keyword instanceof because it is only in Java. ...

BTW, it is now dead easy to add test cases for userdiff patterns. Just
drop files with content like this into t/t4018:

---- t/t4018/csharp-ignore-statement-keywords -----
class Foo {
	public int RIGHT()
	{
		if (x)
		else
		try
		catch (y)
		...

		ChangeMe;
	}
}
-----------------------------------------

(This I just invented, I don't do C#.) See the README file in that
directory.

> ---
>  userdiff.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/userdiff.c b/userdiff.c
> index fad52d6..7612c5d 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -133,14 +133,14 @@ PATTERNS("cpp",
>  	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*"
>  	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
>  PATTERNS("csharp",
> -	 /* Keywords */
> -	 "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
>  	 /* Methods and constructors */
> -	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
> -	 /* Properties */
> -	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
> +	 "^[ \t]*(((abstract|extern|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
> +	 /* Properties, events, delegates */
> +	 "^[ \t]*(((abstract|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*((delegate|event)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
>  	 /* Type definitions */
> -	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
> +	 "^[ \t]*(((abstract|internal|new|override|partial|private|protected|public|sealed|static|unsafe)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
> +	 /* Keywords */
> +	 "!^[ \t]*(as|base|break|case|catch|checked|continue|default|delegate|do|else|finally|fixed|for|foreach|if|in|is|lock|new|null|out|readonly|ref|return|switch|this|throw|try|typeof|unchecked|unsafe|using|var|while)\n"
>  	 /* Namespace */
>  	 "^[ \t]*(namespace[ \t]+.*)$",
>  	 /* -- */

Here, you are moving keywords down, but in the commit message you say
that you "moved keywords to happen before modifier parsing". Aren't you
moving keywords *after* something? (Where the "modifiers" are here is
not obvious, but that can be attributed to that I don't do C#.)

BTW, I appreciate that you re-arrange keywords alphabetically. Could you
do that in the commit message, too?

-- Hannes

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

* Re: [PATCH] Updated C# userdiff patterns.
  2014-04-26  7:10 ` Johannes Sixt
@ 2014-04-26  9:55   ` Marius Ungureanu
  2014-04-26 10:49     ` Marius Ungureanu
  2014-04-26 17:49     ` Johannes Sixt
  0 siblings, 2 replies; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-26  9:55 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git


On 26 Apr 2014, at 10:10, Johannes Sixt <j6t@kdbg.org> wrote:

> Am 26.04.2014 01:25, schrieb Marius Ungureanu:
>> New keywords: foreach, break, in, try, finally, as, is, typeof, var,
>> default, fixed, checked, unchecked, this, lock, readonly, unsafe,
>> ref, out, base, null, delegate, continue.
>> 
>> Removed keywords: instanceof. It's only in Java.
>> Moved keywords to happen before modifier parsing, as matching a keyword
>> will stop modifiers from being matched.
>> 
>> Added method modifiers: extern, abstract.
>> 
>> Added properties modifiers: abstract.
>> 
>> Added parsing of events and delegates, which are like properties, but
>> take an extra keyword.
>> 
>> The reasoning behind adding unsafe to keywords is being also a
>> statement that can happen inline in code to mention blocks which are
>> unsafe. Also, delegates are not necessarily declared in class bodies,
>> but can also happen inline in other functions.
>> 
>> Keywords are based on MSDN docs.
>> 
>> Signed-off-by: Marius Ungureanu <marius.ungureanu@xamarin.com>
> 
> Thanks for your contribution.
> 
> Please write the commit message in imperative mood, and use full
> sentences, not just fragments and avoid contractions ("it's"). Also,
> don't capitalize the subject line and drop the full-stop:
> 
>   update C# userdiff patterns
> 
>   Add new keywords: foreach, break, ...
> 
>   Remove keyword instanceof because it is only in Java. …
> 

Hey!

I’ll fix the commit message and description.

> BTW, it is now dead easy to add test cases for userdiff patterns. Just
> drop files with content like this into t/t4018:
> 
> ---- t/t4018/csharp-ignore-statement-keywords -----
> class Foo {
> 	public int RIGHT()
> 	{
> 		if (x)
> 		else
> 		try
> 		catch (y)
> 		...
> 
> 		ChangeMe;
> 	}
> }
> ————————————————————
> 

Great, I’ll make another commit with adding unit tests. Thanks!

> (This I just invented, I don't do C#.) See the README file in that
> directory.
> 
>> ---
>> userdiff.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>> 
>> diff --git a/userdiff.c b/userdiff.c
>> index fad52d6..7612c5d 100644
>> --- a/userdiff.c
>> +++ b/userdiff.c
>> @@ -133,14 +133,14 @@ PATTERNS("cpp",
>> 	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*"
>> 	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
>> PATTERNS("csharp",
>> -	 /* Keywords */
>> -	 "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
>> 	 /* Methods and constructors */
>> -	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
>> -	 /* Properties */
>> -	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
>> +	 "^[ \t]*(((abstract|extern|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
>> +	 /* Properties, events, delegates */
>> +	 "^[ \t]*(((abstract|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*((delegate|event)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
>> 	 /* Type definitions */
>> -	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
>> +	 "^[ \t]*(((abstract|internal|new|override|partial|private|protected|public|sealed|static|unsafe)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
>> +	 /* Keywords */
>> +	 "!^[ \t]*(as|base|break|case|catch|checked|continue|default|delegate|do|else|finally|fixed|for|foreach|if|in|is|lock|new|null|out|readonly|ref|return|switch|this|throw|try|typeof|unchecked|unsafe|using|var|while)\n"
>> 	 /* Namespace */
>> 	 "^[ \t]*(namespace[ \t]+.*)$",
>> 	 /* -- */
> 
> Here, you are moving keywords down, but in the commit message you say
> that you "moved keywords to happen before modifier parsing". Aren't you
> moving keywords *after* something? (Where the "modifiers" are here is
> not obvious, but that can be attributed to that I don't do C#.)
> 

It was a typo because I was sleepy. It was intentional to move them *after*.
Modifier parsing can contain keywords, so just to be sure, I moved the
keywords after modifier parsing, so it uses the keywords as a fallback.
If this is not what should happen, please tell.

Modifiers are prefixes to methods/properties. (the pipe separated lists)

> BTW, I appreciate that you re-arrange keywords alphabetically. Could you
> do that in the commit message, too?
> 
> — Hannes

I’ll handle this too, no problem.

Thanks,
Marius

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

* Re: [PATCH] Updated C# userdiff patterns.
  2014-04-26  9:55   ` Marius Ungureanu
@ 2014-04-26 10:49     ` Marius Ungureanu
  2014-04-26 17:49     ` Johannes Sixt
  1 sibling, 0 replies; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-26 10:49 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

On a side note, I noticed some of the keywords I added shouldn’t be there.

I just realised that simple statements have no reason to be there, but only
block definitions. I’ll reduce the size of this patch on the keywords part.

Thanks,
Marius

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

* Re: [PATCH] Updated C# userdiff patterns.
  2014-04-26  9:55   ` Marius Ungureanu
  2014-04-26 10:49     ` Marius Ungureanu
@ 2014-04-26 17:49     ` Johannes Sixt
  2014-04-26 18:33       ` Marius Ungureanu
  1 sibling, 1 reply; 16+ messages in thread
From: Johannes Sixt @ 2014-04-26 17:49 UTC (permalink / raw)
  To: Marius Ungureanu; +Cc: git

Am 26.04.2014 11:55, schrieb Marius Ungureanu:
> On 26 Apr 2014, at 10:10, Johannes Sixt <j6t@kdbg.org> wrote:
>> Am 26.04.2014 01:25, schrieb Marius Ungureanu:
>>> diff --git a/userdiff.c b/userdiff.c
>>> index fad52d6..7612c5d 100644
>>> --- a/userdiff.c
>>> +++ b/userdiff.c
>>> @@ -133,14 +133,14 @@ PATTERNS("cpp",
>>> 	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*"
>>> 	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
>>> PATTERNS("csharp",
>>> -	 /* Keywords */
>>> -	 "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
>>> 	 /* Methods and constructors */
>>> -	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
>>> -	 /* Properties */
>>> -	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
>>> +	 "^[ \t]*(((abstract|extern|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
>>> +	 /* Properties, events, delegates */
>>> +	 "^[ \t]*(((abstract|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*((delegate|event)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
>>> 	 /* Type definitions */
>>> -	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
>>> +	 "^[ \t]*(((abstract|internal|new|override|partial|private|protected|public|sealed|static|unsafe)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
>>> +	 /* Keywords */
>>> +	 "!^[ \t]*(as|base|break|case|catch|checked|continue|default|delegate|do|else|finally|fixed|for|foreach|if|in|is|lock|new|null|out|readonly|ref|return|switch|this|throw|try|typeof|unchecked|unsafe|using|var|while)\n"
>>> 	 /* Namespace */
>>> 	 "^[ \t]*(namespace[ \t]+.*)$",
>>> 	 /* -- */
> 
> ...
> Modifier parsing can contain keywords, so just to be sure, I moved the
> keywords after modifier parsing, so it uses the keywords as a fallback.
> If this is not what should happen, please tell.

For each line, patterns are are scanned in order, and the first match
determines the outcome: If it is a negative pattern (i.e., it begins
with an exclamation mark), the line is not a hunk header; if it is a
positive pattern, the line is a hunk header. If no pattern matches, the
line is not a hunk header, either; it is as if the list were terminated
by a negative catch-all pattern.

Due to these rules, negative patterns in the list are only necessary
when you want to make an exception to a positive pattern in the list,
and then the negative pattern must be listed before the positive pattern.

In the csharp case, I do not see a pattern of which the keyword pattern
would make an exception (neither the old version nor your new version).
Therefore, you could drop the keyword pattern entirely.

-- Hannes

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

* Re: [PATCH] Updated C# userdiff patterns.
  2014-04-26 17:49     ` Johannes Sixt
@ 2014-04-26 18:33       ` Marius Ungureanu
  2014-04-26 18:50         ` Johannes Sixt
  0 siblings, 1 reply; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-26 18:33 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

On 26 Apr 2014, at 20:49, Johannes Sixt <j6t@kdbg.org> wrote:
> Am 26.04.2014 11:55, schrieb Marius Ungureanu:
>> On 26 Apr 2014, at 10:10, Johannes Sixt <j6t@kdbg.org> wrote:
>>> Am 26.04.2014 01:25, schrieb Marius Ungureanu:
>>>> diff --git a/userdiff.c b/userdiff.c
>>>> index fad52d6..7612c5d 100644
>>>> --- a/userdiff.c
>>>> +++ b/userdiff.c
>>>> @@ -133,14 +133,14 @@ PATTERNS("cpp",
>>>> 	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*"
>>>> 	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
>>>> PATTERNS("csharp",
>>>> -	 /* Keywords */
>>>> -	 "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
>>>> 	 /* Methods and constructors */
>>>> -	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
>>>> -	 /* Properties */
>>>> -	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
>>>> +	 "^[ \t]*(((abstract|extern|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
>>>> +	 /* Properties, events, delegates */
>>>> +	 "^[ \t]*(((abstract|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*((delegate|event)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
>>>> 	 /* Type definitions */
>>>> -	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
>>>> +	 "^[ \t]*(((abstract|internal|new|override|partial|private|protected|public|sealed|static|unsafe)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
>>>> +	 /* Keywords */
>>>> +	 "!^[ \t]*(as|base|break|case|catch|checked|continue|default|delegate|do|else|finally|fixed|for|foreach|if|in|is|lock|new|null|out|readonly|ref|return|switch|this|throw|try|typeof|unchecked|unsafe|using|var|while)\n"
>>>> 	 /* Namespace */
>>>> 	 "^[ \t]*(namespace[ \t]+.*)$",
>>>> 	 /* -- */
>> 
>> ...
>> Modifier parsing can contain keywords, so just to be sure, I moved the
>> keywords after modifier parsing, so it uses the keywords as a fallback.
>> If this is not what should happen, please tell.
> 
> For each line, patterns are are scanned in order, and the first match
> determines the outcome: If it is a negative pattern (i.e., it begins
> with an exclamation mark), the line is not a hunk header; if it is a
> positive pattern, the line is a hunk header. If no pattern matches, the
> line is not a hunk header, either; it is as if the list were terminated
> by a negative catch-all pattern.
> 
> Due to these rules, negative patterns in the list are only necessary
> when you want to make an exception to a positive pattern in the list,
> and then the negative pattern must be listed before the positive pattern.
> 
> In the csharp case, I do not see a pattern of which the keyword pattern
> would make an exception (neither the old version nor your new version).
> Therefore, you could drop the keyword pattern entirely.
> 
> -- Hannes
> 

Hey!

I’ll remove them and add as many unit tests I can. I’ve been side tracked
today and I couldn’t get to look at it. I’ll start a new thread with the new
patch as soon as I’m done with it.

Thanks for all the tips until now. You’ve been of great help.

Marius

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

* Re: [PATCH] Updated C# userdiff patterns.
  2014-04-26 18:33       ` Marius Ungureanu
@ 2014-04-26 18:50         ` Johannes Sixt
  2014-04-26 18:52           ` Marius Ungureanu
                             ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Johannes Sixt @ 2014-04-26 18:50 UTC (permalink / raw)
  To: Marius Ungureanu; +Cc: git

Am 26.04.2014 20:33, schrieb Marius Ungureanu:
> ... add as many unit tests I can.

Great! Keep in mind that quantity is secondary. Quality counts.

> I’ll start a new thread with the new
> patch as soon as I’m done with it.

If possible, do not start a new thread, but post your new patch as a
reply in this thread.

Thanks,
-- Hannes

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

* Re: [PATCH] Updated C# userdiff patterns.
  2014-04-26 18:50         ` Johannes Sixt
@ 2014-04-26 18:52           ` Marius Ungureanu
  2014-04-27 13:43           ` Marius Ungureanu
                             ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-26 18:52 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git


On 26 Apr 2014, at 21:50, Johannes Sixt <j6t@kdbg.org> wrote:

> Am 26.04.2014 20:33, schrieb Marius Ungureanu:
>> ... add as many unit tests I can.
> 
> Great! Keep in mind that quantity is secondary. Quality counts.

Obviously. By ‘as many’, I meant to cover all the cases here.

>> I’ll start a new thread with the new
>> patch as soon as I’m done with it.
> 
> If possible, do not start a new thread, but post your new patch as a
> reply in this thread.
> 

Okay, understood.

> Thanks,
> -- Hannes
> 

Thanks,
Marius

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

* Re: [PATCH] Updated C# userdiff patterns.
  2014-04-26 18:50         ` Johannes Sixt
  2014-04-26 18:52           ` Marius Ungureanu
@ 2014-04-27 13:43           ` Marius Ungureanu
  2014-04-27 13:45           ` [PATCH 1/2] update " Marius Ungureanu
  2014-04-27 13:47           ` Marius Ungureanu
  3 siblings, 0 replies; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-27 13:43 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Heya, so I’ll add the patches in the next 2 emails.

I’ve changed a bit the main body of the methods/constructors regex.

Basically, I’ve made the first item after the modifiers optional. That’s
the return type and it’s not used in any case by operator overloads
or constructors/destructors.

I also added lots of symbols to the name of the function. Those are
the symbols of the operators that the language allows you to overload.

Thanks in advance,
Marius.

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

* Re: [PATCH 1/2] update C# userdiff patterns
  2014-04-26 18:50         ` Johannes Sixt
  2014-04-26 18:52           ` Marius Ungureanu
  2014-04-27 13:43           ` Marius Ungureanu
@ 2014-04-27 13:45           ` Marius Ungureanu
  2014-04-27 13:48             ` [PATCH 2/2] add csharp userdiff tests Marius Ungureanu
  2014-04-27 13:47           ` Marius Ungureanu
  3 siblings, 1 reply; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-27 13:45 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Remove all keywords since they don't cause conflicts.

Add method modifiers: abstract, async, explicit, extern, implicit,
partial, operator.

Add properties modifiers: abstract, readonly.

Add type modifiers: abstract.

Parse C# operator functions.

Fix constructor parsing.

Signed-off-by: Marius Ungureanu <marius.ungureanu@xamarin.com>
---
 userdiff.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/userdiff.c b/userdiff.c
index fad52d6..e7ba5e3 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -133,14 +133,12 @@ PATTERNS("cpp",
 	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*"
 	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
 PATTERNS("csharp",
-	 /* Keywords */
-	 "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
 	 /* Methods and constructors */
-	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
+	 "^[ \t]*(((abstract|async|explicit|extern|implicit|internal|new|operator|override|partial|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*[][<>@._[:alnum:]]*[ \t]*[-<>@.~=+!*%&|^_[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
 	 /* Properties */
-	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
+	 "^[ \t]*(((abstract|internal|new|override|private|protected|public|readonly|sealed|static|unsafe|virtual)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
 	 /* Type definitions */
-	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
+	 "^[ \t]*(((abstract|internal|new|override|partial|private|protected|public|sealed|static|unsafe)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
 	 /* Namespace */
 	 "^[ \t]*(namespace[ \t]+.*)$",
 	 /* -- */
-- 
1.8.4

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

* Re: [PATCH 2/2] add csharp userdiff tests
  2014-04-26 18:50         ` Johannes Sixt
                             ` (2 preceding siblings ...)
  2014-04-27 13:45           ` [PATCH 1/2] update " Marius Ungureanu
@ 2014-04-27 13:47           ` Marius Ungureanu
  2014-04-27 16:19             ` Johannes Sixt
  3 siblings, 1 reply; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-27 13:47 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git


---
 t/t4018/csharp-constructor | 4 ++++
 t/t4018/csharp-destructor  | 4 ++++
 t/t4018/csharp-function    | 4 ++++
 t/t4018/csharp-member      | 4 ++++
 t/t4018/csharp-namespace   | 4 ++++
 t/t4018/csharp-operator    | 4 ++++
 t/t4018/csharp-property    | 4 ++++
 t/t4018/csharp-skip-call   | 5 +++++
 8 files changed, 33 insertions(+)
 create mode 100644 t/t4018/csharp-constructor
 create mode 100644 t/t4018/csharp-destructor
 create mode 100644 t/t4018/csharp-function
 create mode 100644 t/t4018/csharp-member
 create mode 100644 t/t4018/csharp-namespace
 create mode 100644 t/t4018/csharp-operator
 create mode 100644 t/t4018/csharp-property
 create mode 100644 t/t4018/csharp-skip-call

diff --git a/t/t4018/csharp-constructor b/t/t4018/csharp-constructor
new file mode 100644
index 0000000..a39cffb
--- /dev/null
+++ b/t/t4018/csharp-constructor
@@ -0,0 +1,4 @@
+MyClass(RIGHT)
+{
+	ChangeMe;
+}
diff --git a/t/t4018/csharp-destructor b/t/t4018/csharp-destructor
new file mode 100644
index 0000000..55106d9
--- /dev/null
+++ b/t/t4018/csharp-destructor
@@ -0,0 +1,4 @@
+~MyClass(RIGHT)
+{
+	ChangeMe;
+}
diff --git a/t/t4018/csharp-function b/t/t4018/csharp-function
new file mode 100644
index 0000000..a5d59a3
--- /dev/null
+++ b/t/t4018/csharp-function
@@ -0,0 +1,4 @@
+virtual DoStuff(RIGHT)
+{
+	ChangeMe;
+}
diff --git a/t/t4018/csharp-member b/t/t4018/csharp-member
new file mode 100644
index 0000000..4939d53
--- /dev/null
+++ b/t/t4018/csharp-member
@@ -0,0 +1,4 @@
+unsafe class RIGHT
+{
+	int ChangeMe;
+}
diff --git a/t/t4018/csharp-namespace b/t/t4018/csharp-namespace
new file mode 100644
index 0000000..6749980
--- /dev/null
+++ b/t/t4018/csharp-namespace
@@ -0,0 +1,4 @@
+namespace RIGHT
+{
+	ChangeMe;
+}
diff --git a/t/t4018/csharp-operator b/t/t4018/csharp-operator
new file mode 100644
index 0000000..5b00263
--- /dev/null
+++ b/t/t4018/csharp-operator
@@ -0,0 +1,4 @@
+A operator+(RIGHT)
+{
+	ChangeMe;
+}
diff --git a/t/t4018/csharp-property b/t/t4018/csharp-property
new file mode 100644
index 0000000..82d67fc
--- /dev/null
+++ b/t/t4018/csharp-property
@@ -0,0 +1,4 @@
+public virtual int RIGHT
+{
+	get { ChangeMe; }
+}
diff --git a/t/t4018/csharp-skip-call b/t/t4018/csharp-skip-call
new file mode 100644
index 0000000..e89d083
--- /dev/null
+++ b/t/t4018/csharp-skip-call
@@ -0,0 +1,5 @@
+virtual void RIGHT()
+{
+	call();
+	ChangeMe;
+}
-- 
1.8.4

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

* Re: [PATCH 2/2] add csharp userdiff tests
  2014-04-27 13:45           ` [PATCH 1/2] update " Marius Ungureanu
@ 2014-04-27 13:48             ` Marius Ungureanu
  0 siblings, 0 replies; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-27 13:48 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Ugh, there’s an empty line at the beginning of the 2nd patch that shouldn’t be there.

Thanks,
Marius

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

* Re: [PATCH 2/2] add csharp userdiff tests
  2014-04-27 13:47           ` Marius Ungureanu
@ 2014-04-27 16:19             ` Johannes Sixt
  2014-04-27 16:46               ` Marius Ungureanu
  2014-04-27 17:11               ` Marius Ungureanu
  0 siblings, 2 replies; 16+ messages in thread
From: Johannes Sixt @ 2014-04-27 16:19 UTC (permalink / raw)
  To: Marius Ungureanu; +Cc: git

Am 27.04.2014 15:47, schrieb Marius Ungureanu:
> 
> ---

Thanks. Please signed off your patch.

When you re-send, please place [PATCH v3 n/m] in the subject (and drop
the "Re:") and note what you changed compared to the previous (or all
earlier) rounds. The place for this note is here, after the "---" marker.

Have a look at Documentation/SubmittingPatches.

>  t/t4018/csharp-constructor | 4 ++++
>  t/t4018/csharp-destructor  | 4 ++++
>  t/t4018/csharp-function    | 4 ++++
>  t/t4018/csharp-member      | 4 ++++
>  t/t4018/csharp-namespace   | 4 ++++
>  t/t4018/csharp-operator    | 4 ++++
>  t/t4018/csharp-property    | 4 ++++
>  t/t4018/csharp-skip-call   | 5 +++++
>  8 files changed, 33 insertions(+)
>  create mode 100644 t/t4018/csharp-constructor
>  create mode 100644 t/t4018/csharp-destructor
>  create mode 100644 t/t4018/csharp-function
>  create mode 100644 t/t4018/csharp-member
>  create mode 100644 t/t4018/csharp-namespace
>  create mode 100644 t/t4018/csharp-operator
>  create mode 100644 t/t4018/csharp-property
>  create mode 100644 t/t4018/csharp-skip-call
> 

Unfortunately, I think you have reduced the test cases too far. One of
the main properties of C# code is that usually member and property
definitions are indented and there is a class definition around them:

  class Foo {
     Foo(X) {}
     virtual void DoStuff() {}
     public int X;
  };

In your examples, you omitted the surrounding class definition and did
not indent the member definitions. By doing so, the test cases do not
demonstrate that the csharp userdiff patterns are significantly
different from the default userdiff pattern: in the examples you
present, the default pattern would have picked the same hunk headers as
the csharp patterns!

For a reviewer who is not (or only marginally) familiar with C# (like
myself), it would have been very instructive to present patches with
test cases that demonstrate weaknesses of the old patterns before
patches that fix them. For example, you say that you fix the constructor
pattern. But I am unable to judge what is wrong and how you fix it. The
commit message is the right place to add text that helps reviewers.

You can mark a userdiff test case that demonstrates a breakage by
including the work "broken" somewhere in the file. See
http://www.repo.or.cz/w/alt-git.git/commitdiff/9cc444f0570b196f1c51664ce2de1d8e1dee6046

> diff --git a/t/t4018/csharp-constructor b/t/t4018/csharp-constructor
> new file mode 100644
> index 0000000..a39cffb
> --- /dev/null
> +++ b/t/t4018/csharp-constructor
> @@ -0,0 +1,4 @@
> +MyClass(RIGHT)
> +{
> +	ChangeMe;
> +}
> diff --git a/t/t4018/csharp-destructor b/t/t4018/csharp-destructor
> new file mode 100644
> index 0000000..55106d9
> --- /dev/null
> +++ b/t/t4018/csharp-destructor
> @@ -0,0 +1,4 @@
> +~MyClass(RIGHT)
> +{
> +	ChangeMe;
> +}
> diff --git a/t/t4018/csharp-function b/t/t4018/csharp-function
> new file mode 100644
> index 0000000..a5d59a3
> --- /dev/null
> +++ b/t/t4018/csharp-function
> @@ -0,0 +1,4 @@
> +virtual DoStuff(RIGHT)
> +{
> +	ChangeMe;
> +}
> diff --git a/t/t4018/csharp-member b/t/t4018/csharp-member
> new file mode 100644
> index 0000000..4939d53
> --- /dev/null
> +++ b/t/t4018/csharp-member
> @@ -0,0 +1,4 @@
> +unsafe class RIGHT
> +{
> +	int ChangeMe;
> +}
> diff --git a/t/t4018/csharp-namespace b/t/t4018/csharp-namespace
> new file mode 100644
> index 0000000..6749980
> --- /dev/null
> +++ b/t/t4018/csharp-namespace
> @@ -0,0 +1,4 @@
> +namespace RIGHT
> +{
> +	ChangeMe;
> +}
> diff --git a/t/t4018/csharp-operator b/t/t4018/csharp-operator
> new file mode 100644
> index 0000000..5b00263
> --- /dev/null
> +++ b/t/t4018/csharp-operator

"csharp-user-defined-operator" would more precisely describe the case. I
wouldn't mind seening other file names being a bit more elaborate, but I
find this one particularly ambiguous.

> @@ -0,0 +1,4 @@
> +A operator+(RIGHT)
> +{
> +	ChangeMe;
> +}
> diff --git a/t/t4018/csharp-property b/t/t4018/csharp-property
> new file mode 100644
> index 0000000..82d67fc
> --- /dev/null
> +++ b/t/t4018/csharp-property
> @@ -0,0 +1,4 @@
> +public virtual int RIGHT
> +{
> +	get { ChangeMe; }
> +}
> diff --git a/t/t4018/csharp-skip-call b/t/t4018/csharp-skip-call
> new file mode 100644
> index 0000000..e89d083
> --- /dev/null
> +++ b/t/t4018/csharp-skip-call
> @@ -0,0 +1,5 @@
> +virtual void RIGHT()
> +{
> +	call();
> +	ChangeMe;
> +}

In this last test case, you want to demonstrate that the line "call()"
is not picked as hunk header. As written, the line would never be picked
as hunk header, even if it would match some pattern, because it is too
close to "ChangeMe". You must have at least one more line between
"call()" and "ChangeMe".

BTW, what is the expected hunk header in a diff like the following where
"class Foo" is at line 1 in the file (just above the hunk)?

@@ -2,3 +2,3 @@
 {
-   // old comment
+   // new comment
    public whatever()

That is, when the class definition is undecorated (no "unsafe" etc.)

-- Hannes

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

* Re: [PATCH 2/2] add csharp userdiff tests
  2014-04-27 16:19             ` Johannes Sixt
@ 2014-04-27 16:46               ` Marius Ungureanu
  2014-04-27 20:12                 ` Johannes Sixt
  2014-04-27 17:11               ` Marius Ungureanu
  1 sibling, 1 reply; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-27 16:46 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git


On 27 Apr 2014, at 19:19, Johannes Sixt <j6t@kdbg.org> wrote:

> Am 27.04.2014 15:47, schrieb Marius Ungureanu:
>> 
>> ---
> 
> Thanks. Please signed off your patch.
> 

Ah, yes, forgot to do that.

> When you re-send, please place [PATCH v3 n/m] in the subject (and drop
> the "Re:") and note what you changed compared to the previous (or all
> earlier) rounds. The place for this note is here, after the "---" marker.
> 
> Have a look at Documentation/SubmittingPatches.
> 

Will do so.

>> t/t4018/csharp-constructor | 4 ++++
>> t/t4018/csharp-destructor  | 4 ++++
>> t/t4018/csharp-function    | 4 ++++
>> t/t4018/csharp-member      | 4 ++++
>> t/t4018/csharp-namespace   | 4 ++++
>> t/t4018/csharp-operator    | 4 ++++
>> t/t4018/csharp-property    | 4 ++++
>> t/t4018/csharp-skip-call   | 5 +++++
>> 8 files changed, 33 insertions(+)
>> create mode 100644 t/t4018/csharp-constructor
>> create mode 100644 t/t4018/csharp-destructor
>> create mode 100644 t/t4018/csharp-function
>> create mode 100644 t/t4018/csharp-member
>> create mode 100644 t/t4018/csharp-namespace
>> create mode 100644 t/t4018/csharp-operator
>> create mode 100644 t/t4018/csharp-property
>> create mode 100644 t/t4018/csharp-skip-call
>> 
> 
> Unfortunately, I think you have reduced the test cases too far. One of
> the main properties of C# code is that usually member and property
> definitions are indented and there is a class definition around them:
> 
>  class Foo {
>     Foo(X) {}
>     virtual void DoStuff() {}
>     public int X;
>  };
> 
> In your examples, you omitted the surrounding class definition and did
> not indent the member definitions. By doing so, the test cases do not
> demonstrate that the csharp userdiff patterns are significantly
> different from the default userdiff pattern: in the examples you
> present, the default pattern would have picked the same hunk headers as
> the csharp patterns!
> 

Ah, I think I over judged minimal sample here. I’ll do so.

Is it okay though if I add a few tests to show what is broken?

I think this can’t be solved at a regex level.

> For a reviewer who is not (or only marginally) familiar with C# (like
> myself), it would have been very instructive to present patches with
> test cases that demonstrate weaknesses of the old patterns before
> patches that fix them. For example, you say that you fix the constructor
> pattern. But I am unable to judge what is wrong and how you fix it. The
> commit message is the right place to add text that helps reviewers.
> 

Well, the previous pattern didn’t match constructors as they should be
at a logical level. That means, it considered the constructor name
as being the return type. It’s just a logical change that helped with
writing operator function parsing.

> You can mark a userdiff test case that demonstrates a breakage by
> including the work "broken" somewhere in the file. See
> http://www.repo.or.cz/w/alt-git.git/commitdiff/9cc444f0570b196f1c51664ce2de1d8e1dee6046
> 
>> diff --git a/t/t4018/csharp-constructor b/t/t4018/csharp-constructor
>> new file mode 100644
>> index 0000000..a39cffb
>> --- /dev/null
>> +++ b/t/t4018/csharp-constructor
>> @@ -0,0 +1,4 @@
>> +MyClass(RIGHT)
>> +{
>> +	ChangeMe;
>> +}
>> diff --git a/t/t4018/csharp-destructor b/t/t4018/csharp-destructor
>> new file mode 100644
>> index 0000000..55106d9
>> --- /dev/null
>> +++ b/t/t4018/csharp-destructor
>> @@ -0,0 +1,4 @@
>> +~MyClass(RIGHT)
>> +{
>> +	ChangeMe;
>> +}
>> diff --git a/t/t4018/csharp-function b/t/t4018/csharp-function
>> new file mode 100644
>> index 0000000..a5d59a3
>> --- /dev/null
>> +++ b/t/t4018/csharp-function
>> @@ -0,0 +1,4 @@
>> +virtual DoStuff(RIGHT)
>> +{
>> +	ChangeMe;
>> +}
>> diff --git a/t/t4018/csharp-member b/t/t4018/csharp-member
>> new file mode 100644
>> index 0000000..4939d53
>> --- /dev/null
>> +++ b/t/t4018/csharp-member
>> @@ -0,0 +1,4 @@
>> +unsafe class RIGHT
>> +{
>> +	int ChangeMe;
>> +}
>> diff --git a/t/t4018/csharp-namespace b/t/t4018/csharp-namespace
>> new file mode 100644
>> index 0000000..6749980
>> --- /dev/null
>> +++ b/t/t4018/csharp-namespace
>> @@ -0,0 +1,4 @@
>> +namespace RIGHT
>> +{
>> +	ChangeMe;
>> +}
>> diff --git a/t/t4018/csharp-operator b/t/t4018/csharp-operator
>> new file mode 100644
>> index 0000000..5b00263
>> --- /dev/null
>> +++ b/t/t4018/csharp-operator
> 
> "csharp-user-defined-operator" would more precisely describe the case. I
> wouldn't mind seening other file names being a bit more elaborate, but I
> find this one particularly ambiguous.
> 

Okay, I’ll name them better. Also improve them.

>> @@ -0,0 +1,4 @@
>> +A operator+(RIGHT)
>> +{
>> +	ChangeMe;
>> +}
>> diff --git a/t/t4018/csharp-property b/t/t4018/csharp-property
>> new file mode 100644
>> index 0000000..82d67fc
>> --- /dev/null
>> +++ b/t/t4018/csharp-property
>> @@ -0,0 +1,4 @@
>> +public virtual int RIGHT
>> +{
>> +	get { ChangeMe; }
>> +}
>> diff --git a/t/t4018/csharp-skip-call b/t/t4018/csharp-skip-call
>> new file mode 100644
>> index 0000000..e89d083
>> --- /dev/null
>> +++ b/t/t4018/csharp-skip-call
>> @@ -0,0 +1,5 @@
>> +virtual void RIGHT()
>> +{
>> +	call();
>> +	ChangeMe;
>> +}
> 
> In this last test case, you want to demonstrate that the line "call()"
> is not picked as hunk header. As written, the line would never be picked
> as hunk header, even if it would match some pattern, because it is too
> close to "ChangeMe". You must have at least one more line between
> "call()" and "ChangeMe”.
> 

Oh, forgot about that.

> BTW, what is the expected hunk header in a diff like the following where
> "class Foo" is at line 1 in the file (just above the hunk)?
> 
> @@ -2,3 +2,3 @@
> {
> -   // old comment
> +   // new comment
>    public whatever()
> 
> That is, when the class definition is undecorated (no "unsafe" etc.)

The class name should still get matched in that case even if it isn’t decorated.

> 
> -- Hannes

Marius

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

* Re: [PATCH 2/2] add csharp userdiff tests
  2014-04-27 16:19             ` Johannes Sixt
  2014-04-27 16:46               ` Marius Ungureanu
@ 2014-04-27 17:11               ` Marius Ungureanu
  1 sibling, 0 replies; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-27 17:11 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git


> You can mark a userdiff test case that demonstrates a breakage by
> including the work "broken" somewhere in the file. See
> http://www.repo.or.cz/w/alt-git.git/commitdiff/9cc444f0570b196f1c51664ce2de1d8e1dee6046
> -- Hannes

Would you like me to add tests first, then fix them? Or just like this?

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

* Re: [PATCH 2/2] add csharp userdiff tests
  2014-04-27 16:46               ` Marius Ungureanu
@ 2014-04-27 20:12                 ` Johannes Sixt
  0 siblings, 0 replies; 16+ messages in thread
From: Johannes Sixt @ 2014-04-27 20:12 UTC (permalink / raw)
  To: Marius Ungureanu; +Cc: git

Am 27.04.2014 18:46, schrieb Marius Ungureanu:
> Is it okay though if I add a few tests to show what is broken?
> 
> I think this can’t be solved at a regex level.

It's OK to add tests that show breakages even if there is no immediate
solution.

>> You can mark a userdiff test case that demonstrates a breakage by
>> including the work "broken" somewhere in the file. See
>> http://www.repo.or.cz/w/alt-git.git/commitdiff/9cc444f0570b196f1c51664ce2de1d8e1dee6046

You add tests including broken cases first, and then in the follow-up
patch that fixes the broken ones, you also mark the tests as fixed, like
I did in the follow-up patch of the above example:
http://www.repo.or.cz/w/alt-git.git/commitdiff/8a2e8da367f7175465118510b474ad365161d6b1

-- Hannes

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

end of thread, other threads:[~2014-04-27 20:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-25 23:25 [PATCH] Updated C# userdiff patterns Marius Ungureanu
2014-04-26  7:10 ` Johannes Sixt
2014-04-26  9:55   ` Marius Ungureanu
2014-04-26 10:49     ` Marius Ungureanu
2014-04-26 17:49     ` Johannes Sixt
2014-04-26 18:33       ` Marius Ungureanu
2014-04-26 18:50         ` Johannes Sixt
2014-04-26 18:52           ` Marius Ungureanu
2014-04-27 13:43           ` Marius Ungureanu
2014-04-27 13:45           ` [PATCH 1/2] update " Marius Ungureanu
2014-04-27 13:48             ` [PATCH 2/2] add csharp userdiff tests Marius Ungureanu
2014-04-27 13:47           ` Marius Ungureanu
2014-04-27 16:19             ` Johannes Sixt
2014-04-27 16:46               ` Marius Ungureanu
2014-04-27 20:12                 ` Johannes Sixt
2014-04-27 17:11               ` Marius Ungureanu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.