{"thread":{"id":"51064","subject":"[PATCH] doc/gitattributes: add Octave","startedAt":"2019-05-10T00:47:38Z","lastAt":"2019-05-29T16:16:03Z","messageCount":22,"participants":["Boxuan Li","Philip Oakley","Ævar Arnfjörð Bjarmason","LI, BO XUAN","Junio C Hamano","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"375277","messageId":"20190510004715.29298-1-liboxuan@connect.hku.hk","threadId":"51064","inReplyTo":null,"subject":"[PATCH] doc/gitattributes: add Octave","fromName":"Boxuan Li","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-10T00:47:15Z","receivedAt":"2019-05-10T00:47:38Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"`matlab` pattern is also suitable for source code\nin the GNU Octave language.\n\nSigned-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n---\n Documentation/gitattributes.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 4fb20cd0e9..1b28381bda 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -819,7 +819,7 @@ patterns are available:\n \n - `java` suitable for source code in the Java language.\n \n-- `matlab` suitable for source code in the MATLAB language.\n+- `matlab` suitable for source code in the MATLAB/Octave language.\n \n - `objc` suitable for source code in the Objective-C language.\n \n-- \n2.21.0.777.g83232e3864\n\n"},{"id":"375327","messageId":"c1bef9da-e588-233f-b2c9-ed2b9932d4e6@iee.org","threadId":"51064","inReplyTo":"20190510004715.29298-1-liboxuan@connect.hku.hk","subject":"Re: [PATCH] doc/gitattributes: add Octave","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-05-10T23:09:29Z","receivedAt":"2019-05-10T23:09:34Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 10/05/2019 01:47, Boxuan Li wrote:\n> `matlab` pattern is also suitable for source code\n> in the GNU Octave language.\n>\n> Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n> ---\n>   Documentation/gitattributes.txt | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index 4fb20cd0e9..1b28381bda 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -819,7 +819,7 @@ patterns are available:\n>   \n>   - `java` suitable for source code in the Java language.\n>   \n> -- `matlab` suitable for source code in the MATLAB language.\n> +- `matlab` suitable for source code in the MATLAB/Octave language.\n>   \n>   - `objc` suitable for source code in the Objective-C language.\n>   \nLooks good to me.\nWill help Octave users searching on their name for the Open Source \nvariant of Matlab.\n--\nPhilip\n"},{"id":"375328","messageId":"87woixx556.fsf@evledraar.gmail.com","threadId":"51064","inReplyTo":"20190510004715.29298-1-liboxuan@connect.hku.hk","subject":"Re: [PATCH] doc/gitattributes: add Octave","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2019-05-10T23:26:45Z","receivedAt":"2019-05-10T23:26:50Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Fri, May 10 2019, Boxuan Li wrote:\n\n> `matlab` pattern is also suitable for source code\n> in the GNU Octave language.\n>\n> Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n> ---\n>  Documentation/gitattributes.txt | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index 4fb20cd0e9..1b28381bda 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -819,7 +819,7 @@ patterns are available:\n>\n>  - `java` suitable for source code in the Java language.\n>\n> -- `matlab` suitable for source code in the MATLAB language.\n> +- `matlab` suitable for source code in the MATLAB/Octave language.\n>\n>  - `objc` suitable for source code in the Objective-C language.\n\nI've never used either, but browsing our patterns I see:\n\n         \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n\nI.e. that last bit matches ^%%, and then here:\nhttps://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB\n\n    MATLAB uses the percent sign '%' to begin a comment. Octave uses\n    both the hash symbol # and the percent sign % interchangeably.\n\nSo here we have the \"function\" pattern matching a comment, right? (this\ndoesn't have any tests) and we'd want to add \"#\" to Octave, but not\nMATLAB.\n\nI see both tend to use the \".m\" extension. Anyway, isn't it better to\nadd an \"octave\" pattern, and document that they're mostly the same\n(although it looks like we can add #-comments, to future-proof\nourselves?\n"},{"id":"375332","messageId":"CALM0=-mTLakSBW67vqHNX84p=uw990QDbpeUfh1HKq9N0CiiLA@mail.gmail.com","threadId":"51064","inReplyTo":"87woixx556.fsf@evledraar.gmail.com","subject":"Re: [PATCH] doc/gitattributes: add Octave","fromName":"LI, BO XUAN","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-11T02:36:00Z","receivedAt":"2019-05-11T02:36:39Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"On Sat, May 11, 2019 at 7:26 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n>\n> On Fri, May 10 2019, Boxuan Li wrote:\n>\n> > `matlab` pattern is also suitable for source code\n> > in the GNU Octave language.\n> >\n> > Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n> > ---\n> >  Documentation/gitattributes.txt | 2 +-\n> >  1 file changed, 1 insertion(+), 1 deletion(-)\n> >\n> > diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> > index 4fb20cd0e9..1b28381bda 100644\n> > --- a/Documentation/gitattributes.txt\n> > +++ b/Documentation/gitattributes.txt\n> > @@ -819,7 +819,7 @@ patterns are available:\n> >\n> >  - `java` suitable for source code in the Java language.\n> >\n> > -- `matlab` suitable for source code in the MATLAB language.\n> > +- `matlab` suitable for source code in the MATLAB/Octave language.\n> >\n> >  - `objc` suitable for source code in the Objective-C language.\n>\n> I've never used either, but browsing our patterns I see:\n>\n>          \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n>\n> I.e. that last bit matches ^%%, and then here:\n> https://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB\n>\n>     MATLAB uses the percent sign '%' to begin a comment. Octave uses\n>     both the hash symbol # and the percent sign % interchangeably.\n>\n> So here we have the \"function\" pattern matching a comment, right? (this\n> doesn't have any tests) and we'd want to add \"#\" to Octave, but not\n> MATLAB.\n\nThanks, that's a great catch! Actually, '%%' is used to start a code\nsection in Matlab\n(https://www.mathworks.com/help/matlab/matlab_prog/run-sections-of-programs.html),\nwhile Octave uses both '%%' and '##'\n(https://octave.org/doc/interpreter/Sections.html).\n\n>\n> I see both tend to use the \".m\" extension. Anyway, isn't it better to\n> add an \"octave\" pattern, and document that they're mostly the same\n\nI agree. I'll send an updated patch soon.\n\n> (although it looks like we can add #-comments, to future-proof\n> ourselves?\n"},{"id":"375333","messageId":"20190511040819.49985-1-liboxuan@connect.hku.hk","threadId":"51064","inReplyTo":"CALM0=-mTLakSBW67vqHNX84p=uw990QDbpeUfh1HKq9N0CiiLA@mail.gmail.com","subject":"[PATCH v2] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Boxuan Li","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-11T04:08:19Z","receivedAt":"2019-05-11T04:08:42Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"Octave pattern is almost the same as matlab. Besides,\noctave also uses '%%%' or '##' to begin code sections.\n\nSigned-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n---\nv1: use matlab pattern for octave language\n---\n Documentation/gitattributes.txt | 2 ++\n userdiff.c                      | 5 +++++\n 2 files changed, 7 insertions(+)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 4fb20cd0e9..45374c7dd3 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -821,6 +821,8 @@ patterns are available:\n \n - `matlab` suitable for source code in the MATLAB language.\n \n+- `octave` suitable for source code in the Octave language.\n+\n - `objc` suitable for source code in the Objective-C language.\n \n - `pascal` suitable for source code in the Pascal/Delphi language.\ndiff --git a/userdiff.c b/userdiff.c\nindex 3a78fbf504..6e9b56f1d6 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -60,6 +60,11 @@ PATTERNS(\"java\",\n PATTERNS(\"matlab\",\n \t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n \t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n+PATTERNS(\"octave\",\n+     /* Mostly the same as matlab. In addition, Octave\n+      * supports '##' and '%%%' for code sections */\n+     \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n+     \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n PATTERNS(\"objc\",\n \t /* Negate C statements that can look like functions */\n \t \"!^[ \\t]*(do|for|if|else|return|switch|while)\\n\"\n-- \n2.21.0.777.g83232e3864\n\n"},{"id":"375334","messageId":"20190511041331.51642-1-liboxuan@connect.hku.hk","threadId":"51064","inReplyTo":"CALM0=-mTLakSBW67vqHNX84p=uw990QDbpeUfh1HKq9N0CiiLA@mail.gmail.com","subject":"[PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Boxuan Li","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-11T04:13:31Z","receivedAt":"2019-05-11T04:13:43Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"Octave pattern is almost the same as matlab. Besides,\noctave also uses '%%%' or '##' to begin code sections.\n\nSigned-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n---\nUpdate from v2: fix indentation\n---\n Documentation/gitattributes.txt | 2 ++\n userdiff.c                      | 5 +++++\n 2 files changed, 7 insertions(+)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 4fb20cd0e9..45374c7dd3 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -821,6 +821,8 @@ patterns are available:\n \n - `matlab` suitable for source code in the MATLAB language.\n \n+- `octave` suitable for source code in the Octave language.\n+\n - `objc` suitable for source code in the Objective-C language.\n \n - `pascal` suitable for source code in the Pascal/Delphi language.\ndiff --git a/userdiff.c b/userdiff.c\nindex 3a78fbf504..7d07b82116 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -60,6 +60,11 @@ PATTERNS(\"java\",\n PATTERNS(\"matlab\",\n \t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n \t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n+PATTERNS(\"octave\",\n+\t /* Mostly the same as matlab. In addition, Octave\n+\t  * supports '##' and '%%%' for code sections */\n+\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n+\t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n PATTERNS(\"objc\",\n \t /* Negate C statements that can look like functions */\n \t \"!^[ \\t]*(do|for|if|else|return|switch|while)\\n\"\n-- \n2.21.0.777.g83232e3864\n\n"},{"id":"375597","messageId":"xmqq4l5w7001.fsf@gitster-ct.c.googlers.com","threadId":"51064","inReplyTo":"20190511041331.51642-1-liboxuan@connect.hku.hk","subject":"Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-05-15T05:35:58Z","receivedAt":"2019-05-15T05:36:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Boxuan Li <liboxuan@connect.hku.hk> writes:\n\n> Octave pattern is almost the same as matlab. Besides,\n> octave also uses '%%%' or '##' to begin code sections.\n\nMy reading of the above hiccupped at around \"Besides, octave also\nuses...\".\n\nChecking the differences in patterns, I think\n\n\t... the same as matlab, except that '%%%' and '##' can also\n\tbe used to begin code sections, in addition to '%%' that is\n\tunderstood by both.\n\nmay be easier to read. It makes it clear that you'd want to stay\naway from %%% and ## if you want to be compatible.\n\nThanks.\n\n> Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n> ---\n> Update from v2: fix indentation\n> ---\n>  Documentation/gitattributes.txt | 2 ++\n>  userdiff.c                      | 5 +++++\n>  2 files changed, 7 insertions(+)\n>\n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index 4fb20cd0e9..45374c7dd3 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -821,6 +821,8 @@ patterns are available:\n>  \n>  - `matlab` suitable for source code in the MATLAB language.\n>  \n> +- `octave` suitable for source code in the Octave language.\n> +\n>  - `objc` suitable for source code in the Objective-C language.\n>  \n>  - `pascal` suitable for source code in the Pascal/Delphi language.\n> diff --git a/userdiff.c b/userdiff.c\n> index 3a78fbf504..7d07b82116 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -60,6 +60,11 @@ PATTERNS(\"java\",\n>  PATTERNS(\"matlab\",\n>  \t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n>  \t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n> +PATTERNS(\"octave\",\n> +\t /* Mostly the same as matlab. In addition, Octave\n> +\t  * supports '##' and '%%%' for code sections */\n> +\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n> +\t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n>  PATTERNS(\"objc\",\n>  \t /* Negate C statements that can look like functions */\n>  \t \"!^[ \\t]*(do|for|if|else|return|switch|while)\\n\"\n"},{"id":"375598","messageId":"20190515055540.30558-1-liboxuan@connect.hku.hk","threadId":"51064","inReplyTo":"CALM0=-mTLakSBW67vqHNX84p=uw990QDbpeUfh1HKq9N0CiiLA@mail.gmail.com","subject":"[PATCH v4] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Boxuan Li","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-15T05:55:40Z","receivedAt":"2019-05-15T05:56:04Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"Octave pattern is almost the same as matlab, except\nthat '%%%' and '##' can also be used to begin code sections,\nin addition to '%%' that is understood by both.\n\nSigned-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n---\nThanks to all the reviewers above, this is the fourth version:\nv1: use matlab pattern for octave\nv2: add a new octave pattern\nv3: fix indentation problem of v2\nv4: improve doc and commit message\n---\n Documentation/gitattributes.txt | 2 ++\n userdiff.c                      | 5 +++++\n 2 files changed, 7 insertions(+)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 4fb20cd0e9..45374c7dd3 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -821,6 +821,8 @@ patterns are available:\n \n - `matlab` suitable for source code in the MATLAB language.\n \n+- `octave` suitable for source code in the Octave language.\n+\n - `objc` suitable for source code in the Objective-C language.\n \n - `pascal` suitable for source code in the Pascal/Delphi language.\ndiff --git a/userdiff.c b/userdiff.c\nindex 3a78fbf504..1127a4c6b1 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -60,6 +60,11 @@ PATTERNS(\"java\",\n PATTERNS(\"matlab\",\n \t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n \t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n+PATTERNS(\"octave\",\n+\t /* Mostly the same as matlab, except that '%%%' and '##' can also be used\n+\t  * to begin code sections, in addition to '%%' that is understood by both. */\n+\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n+\t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n PATTERNS(\"objc\",\n \t /* Negate C statements that can look like functions */\n \t \"!^[ \\t]*(do|for|if|else|return|switch|while)\\n\"\n-- \n2.21.0.777.g83232e3864\n\n"},{"id":"375599","messageId":"aa86f483-9c73-eb6d-1a73-80fd4894c093@kdbg.org","threadId":"51064","inReplyTo":"20190511041331.51642-1-liboxuan@connect.hku.hk","subject":"Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-05-15T05:57:22Z","receivedAt":"2019-05-15T05:57:27Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 11.05.19 um 06:13 schrieb Boxuan Li:\n> Octave pattern is almost the same as matlab. Besides,\n> octave also uses '%%%' or '##' to begin code sections.\n> \n\n> @@ -60,6 +60,11 @@ PATTERNS(\"java\",\n>  PATTERNS(\"matlab\",\n>  \t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n>  \t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n> +PATTERNS(\"octave\",\n> +\t /* Mostly the same as matlab. In addition, Octave\n> +\t  * supports '##' and '%%%' for code sections */\n> +\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n> +\t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n>  PATTERNS(\"objc\",\n>  \t /* Negate C statements that can look like functions */\n>  \t \"!^[ \\t]*(do|for|if|else|return|switch|while)\\n\"\n> \n\nIn Matlab, are %%% and ## valid syntax? If not, instead of introducing a\nnew language, please just extend the Matlab rule to treat %%% and ## as\nyou need for Octave and mark your Octave files as Matlab.\n\n-- Hannes\n"},{"id":"375600","messageId":"CALM0=-n_=8K4RWE9MvwPFT26UwN-rAA09ryqdTfEF4GJ57YBjg@mail.gmail.com","threadId":"51064","inReplyTo":"aa86f483-9c73-eb6d-1a73-80fd4894c093@kdbg.org","subject":"Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"LI, BO XUAN","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-15T06:15:14Z","receivedAt":"2019-05-15T06:15:52Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"On Wed, May 15, 2019 at 1:57 PM Johannes Sixt <j6t@kdbg.org> wrote:\n>\n> Am 11.05.19 um 06:13 schrieb Boxuan Li:\n> > Octave pattern is almost the same as matlab. Besides,\n> > octave also uses '%%%' or '##' to begin code sections.\n> >\n>\n> > @@ -60,6 +60,11 @@ PATTERNS(\"java\",\n> >  PATTERNS(\"matlab\",\n> >        \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n> >        \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n> > +PATTERNS(\"octave\",\n> > +      /* Mostly the same as matlab. In addition, Octave\n> > +       * supports '##' and '%%%' for code sections */\n> > +      \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n> > +      \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n> >  PATTERNS(\"objc\",\n> >        /* Negate C statements that can look like functions */\n> >        \"!^[ \\t]*(do|for|if|else|return|switch|while)\\n\"\n> >\n>\n> In Matlab, are %%% and ## valid syntax? If not, instead of introducing a\n> new language, please just extend the Matlab rule to treat %%% and ## as\n> you need for Octave and mark your Octave files as Matlab.\n>\n> -- Hannes\n\nHi Hannes,\n\n'##' is not valid syntax in Matlab scripts.\n\n'%%%' is valid syntax in Matlab. However, it is not used as a section divider.\n\nref: https://www.mathworks.com/help/matlab/matlab_prog/run-sections-of-programs.html\nref: https://octave.org/doc/interpreter/Sections.html\n\nBest regards,\nBoxuan\n"},{"id":"375633","messageId":"a2455214-9ce5-71e3-74bc-114af6fcfca7@kdbg.org","threadId":"51064","inReplyTo":"CALM0=-n_=8K4RWE9MvwPFT26UwN-rAA09ryqdTfEF4GJ57YBjg@mail.gmail.com","subject":"Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-05-15T17:46:18Z","receivedAt":"2019-05-15T17:46:24Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 15.05.19 um 08:15 schrieb LI, BO XUAN:\n> On Wed, May 15, 2019 at 1:57 PM Johannes Sixt <j6t@kdbg.org> wrote:\n>>\n>> Am 11.05.19 um 06:13 schrieb Boxuan Li:\n>>> Octave pattern is almost the same as matlab. Besides,\n>>> octave also uses '%%%' or '##' to begin code sections.\n>>>\n>>\n>>> @@ -60,6 +60,11 @@ PATTERNS(\"java\",\n>>>  PATTERNS(\"matlab\",\n>>>        \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n>>>        \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n>>> +PATTERNS(\"octave\",\n>>> +      /* Mostly the same as matlab. In addition, Octave\n>>> +       * supports '##' and '%%%' for code sections */\n>>> +      \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n>>> +      \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n>>>  PATTERNS(\"objc\",\n>>>        /* Negate C statements that can look like functions */\n>>>        \"!^[ \\t]*(do|for|if|else|return|switch|while)\\n\"\n>>>\n>>\n>> In Matlab, are %%% and ## valid syntax? If not, instead of introducing a\n>> new language, please just extend the Matlab rule to treat %%% and ## as\n>> you need for Octave and mark your Octave files as Matlab.\n> \n> '##' is not valid syntax in Matlab scripts.\n> \n> '%%%' is valid syntax in Matlab. However, it is not used as a section divider.\n\nIn Matlab, is %%% followed by space at the beginning of a line\n*commonly* used for something different? If I were to make a guess, I\nwould say no. If I'm right, it does not hurt to merge the Octave rules\ninto the Matlab rules.\n\n-- Hannes\n"},{"id":"375710","messageId":"xmqqlfz64uzw.fsf@gitster-ct.c.googlers.com","threadId":"51064","inReplyTo":"a2455214-9ce5-71e3-74bc-114af6fcfca7@kdbg.org","subject":"Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-05-16T09:19:15Z","receivedAt":"2019-05-16T09:19:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> In Matlab, is %%% followed by space at the beginning of a line\n> *commonly* used for something different? If I were to make a guess, I\n> would say no. If I'm right, it does not hurt to merge the Octave rules\n> into the Matlab rules.\n\nThat is true because we are not syntax-aware and error-highlighting\ntext editor.  If we were, I'd suspect that your stance may probably\nbe different.  But instead we apply these patterns to a program that\nis assumed to be correctly written.\n\nAnd from that point of view, I agree with you that it would not hurt\nto make the existing patterns for Matlab slightly more receptive so\nthat a correctly written programs in either language would be matched\nappropriately.\n\nBut would it hurt to have two similar entries, with a clear\ndescription on how they are different, in our code there, given how\ninfrequently individual entries have historically been updated?\n"},{"id":"375738","messageId":"262eb1d4-a898-c6d0-8e04-ce6c58eaa4e6@kdbg.org","threadId":"51064","inReplyTo":"xmqqlfz64uzw.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-05-16T19:20:57Z","receivedAt":"2019-05-16T19:21:01Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 16.05.19 um 11:19 schrieb Junio C Hamano:\n> Johannes Sixt <j6t@kdbg.org> writes:\n> \n>> In Matlab, is %%% followed by space at the beginning of a line\n>> *commonly* used for something different? If I were to make a guess, I\n>> would say no. If I'm right, it does not hurt to merge the Octave rules\n>> into the Matlab rules.\n> \n> That is true because we are not syntax-aware and error-highlighting\n> text editor.  If we were, I'd suspect that your stance may probably\n> be different.  But instead we apply these patterns to a program that\n> is assumed to be correctly written.\n\nCorrect!\n\n> And from that point of view, I agree with you that it would not hurt\n> to make the existing patterns for Matlab slightly more receptive so\n> that a correctly written programs in either language would be matched\n> appropriately.\n> \n> But would it hurt to have two similar entries, with a clear\n> description on how they are different, in our code there, given how\n> infrequently individual entries have historically been updated?\n\nWould it hurt? Probably not. Should we open the door for everybody's\nfavorite dialect? Probably not, either.\n\nSee, we do not even have separate entries for C and C++. Heck, we don't\nhave an XML entry, because the HTML entry is good enough, and there are\nprobably many more XML users than Matlab and Octave users together.\n\nI'd prefer to keep this list at the minimum necessary as long as it is\nhard-coded in C. I would take a different stance if this were some\nconfiguration file that we ship.\n\n-- Hannes\n"},{"id":"375766","messageId":"xmqq8sv63rfc.fsf@gitster-ct.c.googlers.com","threadId":"51064","inReplyTo":"262eb1d4-a898-c6d0-8e04-ce6c58eaa4e6@kdbg.org","subject":"Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-05-16T23:33:59Z","receivedAt":"2019-05-16T23:34:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> I'd prefer to keep this list at the minimum necessary as long as it is\n> hard-coded in C.\n\nYeah, I know that feeling.\n\n> I would take a different stance if this were some\n> configuration file that we ship.\n\nHmm, now you reminded me of my ancient wish.\n\nPerhaps it is not too bad to ship $(sharedir)/git-core/userdiff that\ncan be read using git_config_from_file() interface, using a very\nnarrow callback function that understands only diff.*.xfuncname and\ndiff.*.wordregex and discards everything else, without even\nfollowing the include/includeIf stuff?  As long as that can be done\nsafely and without too much overhead, we could get rid of the\nhardcoded patterns in userdiff.c::builtin_drivers[] and that would\nbe wonderful ;-)\n\n"},{"id":"375801","messageId":"CALM0=-=2PBLm6+pQxUq5L2=8hEUh3nFFheFN=HhN5CUGj6Kfeg@mail.gmail.com","threadId":"51064","inReplyTo":"xmqq8sv63rfc.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"LI, BO XUAN","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-17T12:19:34Z","receivedAt":"2019-05-17T12:20:12Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"On Fri, May 17, 2019 at 7:34 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Johannes Sixt <j6t@kdbg.org> writes:\n>\n> > I'd prefer to keep this list at the minimum necessary as long as it is\n> > hard-coded in C.\n>\n> Yeah, I know that feeling.\n>\n\nSo do we reach a consensus? Should I merge the Octave rules into Matlab rules?\n\nBest regards,\nBoxuan\n\n> > I would take a different stance if this were some\n> > configuration file that we ship.\n>\n> Hmm, now you reminded me of my ancient wish.\n>\n> Perhaps it is not too bad to ship $(sharedir)/git-core/userdiff that\n> can be read using git_config_from_file() interface, using a very\n> narrow callback function that understands only diff.*.xfuncname and\n> diff.*.wordregex and discards everything else, without even\n> following the include/includeIf stuff?  As long as that can be done\n> safely and without too much overhead, we could get rid of the\n> hardcoded patterns in userdiff.c::builtin_drivers[] and that would\n> be wonderful ;-)\n>\n"},{"id":"375820","messageId":"cb16942d-3e2e-d5b0-4eb8-25937cd9d573@kdbg.org","threadId":"51064","inReplyTo":"CALM0=-=2PBLm6+pQxUq5L2=8hEUh3nFFheFN=HhN5CUGj6Kfeg@mail.gmail.com","subject":"Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-05-17T19:47:44Z","receivedAt":"2019-05-17T19:47:50Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 17.05.19 um 14:19 schrieb LI, BO XUAN:\n> On Fri, May 17, 2019 at 7:34 AM Junio C Hamano <gitster@pobox.com> wrote:\n>>\n>> Johannes Sixt <j6t@kdbg.org> writes:\n>>\n>>> I'd prefer to keep this list at the minimum necessary as long as it is\n>>> hard-coded in C.\n>>\n>> Yeah, I know that feeling.\n> \n> So do we reach a consensus? Should I merge the Octave rules into Matlab rules?\n\nYes, please, that would be very much appreciated. Bonus points if you\nadd some test cases for the hunk header patterns to the t/t4018 directory.\n\n-- Hannes\n"},{"id":"375838","messageId":"20190518034623.87702-1-liboxuan@connect.hku.hk","threadId":"51064","inReplyTo":"CALM0=-mTLakSBW67vqHNX84p=uw990QDbpeUfh1HKq9N0CiiLA@mail.gmail.com","subject":"[PATCH v5] userdiff: add Octave","fromName":"Boxuan Li","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-18T03:46:23Z","receivedAt":"2019-05-18T03:47:13Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"Octave pattern is almost the same as matlab, except\nthat '%%%' and '##' can also be used to begin code sections,\nin addition to '%%' that is understood by both. Octave\npattern is merged into Matlab pattern. Test cases for\nthe hunk header patterns of matlab and octave under\nt/t4018 are added.\n\nSigned-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n---\nv1: use matlab pattern for octave\nv2: add a new octave pattern\nv3: fix indentation problem of v2\nv4: improve doc and commit message\nv5: merge octave pattern into matlab and add test cases\n---\n Documentation/gitattributes.txt | 2 +-\n t/t4018/matlab-class-definition | 5 +++++\n t/t4018/matlab-function         | 4 ++++\n t/t4018/matlab-octave-section-1 | 3 +++\n t/t4018/matlab-octave-section-2 | 3 +++\n t/t4018/matlab-section          | 3 +++\n userdiff.c                      | 5 ++++-\n 7 files changed, 23 insertions(+), 2 deletions(-)\n create mode 100644 t/t4018/matlab-class-definition\n create mode 100644 t/t4018/matlab-function\n create mode 100644 t/t4018/matlab-octave-section-1\n create mode 100644 t/t4018/matlab-octave-section-2\n create mode 100644 t/t4018/matlab-section\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 4fb20cd0e9..e657a6b7b7 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -819,7 +819,7 @@ patterns are available:\n \n - `java` suitable for source code in the Java language.\n \n-- `matlab` suitable for source code in the MATLAB language.\n+- `matlab` suitable for source code in the MATLAB and Octave language.\n \n - `objc` suitable for source code in the Objective-C language.\n \ndiff --git a/t/t4018/matlab-class-definition b/t/t4018/matlab-class-definition\nnew file mode 100644\nindex 0000000000..84daedfb4e\n--- /dev/null\n+++ b/t/t4018/matlab-class-definition\n@@ -0,0 +1,5 @@\n+classdef RIGHT\n+    properties\n+        ChangeMe\n+    end\n+end\ndiff --git a/t/t4018/matlab-function b/t/t4018/matlab-function\nnew file mode 100644\nindex 0000000000..897a9b13ff\n--- /dev/null\n+++ b/t/t4018/matlab-function\n@@ -0,0 +1,4 @@\n+function y = RIGHT()\n+x = 5;\n+y = ChangeMe + x;\n+end\ndiff --git a/t/t4018/matlab-octave-section-1 b/t/t4018/matlab-octave-section-1\nnew file mode 100644\nindex 0000000000..3bb6c4670e\n--- /dev/null\n+++ b/t/t4018/matlab-octave-section-1\n@@ -0,0 +1,3 @@\n+%%% RIGHT section\n+# this is octave script\n+ChangeMe = 1;\ndiff --git a/t/t4018/matlab-octave-section-2 b/t/t4018/matlab-octave-section-2\nnew file mode 100644\nindex 0000000000..ab2980f7f2\n--- /dev/null\n+++ b/t/t4018/matlab-octave-section-2\n@@ -0,0 +1,3 @@\n+## RIGHT section\n+# this is octave script\n+ChangeMe = 1;\ndiff --git a/t/t4018/matlab-section b/t/t4018/matlab-section\nnew file mode 100644\nindex 0000000000..5ea59a5de0\n--- /dev/null\n+++ b/t/t4018/matlab-section\n@@ -0,0 +1,3 @@\n+%% RIGHT section\n+% this is understood by both matlab and octave\n+ChangeMe = 1;\ndiff --git a/userdiff.c b/userdiff.c\nindex 3a78fbf504..bcae006abe 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -58,7 +58,10 @@ PATTERNS(\"java\",\n \t \"|[-+*/<>%&^|=!]=\"\n \t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n PATTERNS(\"matlab\",\n-\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n+\t /* Octave pattern is mostly the same as matlab, except that '%%%' and\n+\t  * '##' can also be used to begin code sections, in addition to '%%'\n+\t  * that is understood by both. */\n+\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n \t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n PATTERNS(\"objc\",\n \t /* Negate C statements that can look like functions */\n-- \n2.21.0.777.g83232e3864\n\n"},{"id":"375950","messageId":"3b7a22e8-0310-3738-0476-b6d73f187331@kdbg.org","threadId":"51064","inReplyTo":"20190518034623.87702-1-liboxuan@connect.hku.hk","subject":"Re: [PATCH v5] userdiff: add Octave","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-05-20T19:26:01Z","receivedAt":"2019-05-20T19:26:08Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 18.05.19 um 05:46 schrieb Boxuan Li:\n> Octave pattern is almost the same as matlab, except\n> that '%%%' and '##' can also be used to begin code sections,\n> in addition to '%%' that is understood by both. Octave\n> pattern is merged into Matlab pattern. Test cases for\n> the hunk header patterns of matlab and octave under\n> t/t4018 are added.\n\nThank you! This patch looks good. With or without the grammar and style\nfixes below:\n\nAcked-by: Johannes Sixt <j6t@kdbg.org>\n\nJunio will very likely appreciate if you resend with these fixes applied.\n\n> \n> Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n> ---\n> v1: use matlab pattern for octave\n> v2: add a new octave pattern\n> v3: fix indentation problem of v2\n> v4: improve doc and commit message\n> v5: merge octave pattern into matlab and add test cases\n> ---\n\n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index 4fb20cd0e9..e657a6b7b7 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -819,7 +819,7 @@ patterns are available:\n>  \n>  - `java` suitable for source code in the Java language.\n>  \n> -- `matlab` suitable for source code in the MATLAB language.\n> +- `matlab` suitable for source code in the MATLAB and Octave language.\n\ns/language/languages/\n\n>  \n>  - `objc` suitable for source code in the Objective-C language.\n>  \n\n> diff --git a/userdiff.c b/userdiff.c\n> index 3a78fbf504..bcae006abe 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -58,7 +58,10 @@ PATTERNS(\"java\",\n>  \t \"|[-+*/<>%&^|=!]=\"\n>  \t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n>  PATTERNS(\"matlab\",\n> -\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n> +\t /* Octave pattern is mostly the same as matlab, except that '%%%' and\n> +\t  * '##' can also be used to begin code sections, in addition to '%%'\n> +\t  * that is understood by both. */\n\n\t/*\n\t * We write multi-line\n\t * comments like this.\n\t */\n\n> +\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n>  \t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n>  PATTERNS(\"objc\",\n>  \t /* Negate C statements that can look like functions */\n> \n\n-- Hannes\n"},{"id":"376001","messageId":"20190521145718.56693-1-liboxuan@connect.hku.hk","threadId":"51064","inReplyTo":"3b7a22e8-0310-3738-0476-b6d73f187331@kdbg.org","subject":"[PATCH v6] userdiff: add Octave","fromName":"Boxuan Li","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-21T14:57:18Z","receivedAt":"2019-05-21T14:57:32Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"Octave pattern is almost the same as matlab, except\nthat '%%%' and '##' can also be used to begin code sections,\nin addition to '%%' that is understood by both. Octave\npattern is merged into Matlab pattern. Test cases for\nthe hunk header patterns of matlab and octave under\nt/t4018 are added.\n\nSigned-off-by: Boxuan Li <liboxuan@connect.hku.hk>\nAcked-by: Johannes Sixt <j6t@kdbg.org>\n---\nThanks to review from Johannes, update from v5:\nFix grammar and style\n---\n Documentation/gitattributes.txt | 2 +-\n t/t4018/matlab-class-definition | 5 +++++\n t/t4018/matlab-function         | 4 ++++\n t/t4018/matlab-octave-section-1 | 3 +++\n t/t4018/matlab-octave-section-2 | 3 +++\n t/t4018/matlab-section          | 3 +++\n userdiff.c                      | 7 ++++++-\n 7 files changed, 25 insertions(+), 2 deletions(-)\n create mode 100644 t/t4018/matlab-class-definition\n create mode 100644 t/t4018/matlab-function\n create mode 100644 t/t4018/matlab-octave-section-1\n create mode 100644 t/t4018/matlab-octave-section-2\n create mode 100644 t/t4018/matlab-section\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 4fb20cd0e9..e387cc6dda 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -819,7 +819,7 @@ patterns are available:\n \n - `java` suitable for source code in the Java language.\n \n-- `matlab` suitable for source code in the MATLAB language.\n+- `matlab` suitable for source code in the MATLAB and Octave languages.\n \n - `objc` suitable for source code in the Objective-C language.\n \ndiff --git a/t/t4018/matlab-class-definition b/t/t4018/matlab-class-definition\nnew file mode 100644\nindex 0000000000..84daedfb4e\n--- /dev/null\n+++ b/t/t4018/matlab-class-definition\n@@ -0,0 +1,5 @@\n+classdef RIGHT\n+    properties\n+        ChangeMe\n+    end\n+end\ndiff --git a/t/t4018/matlab-function b/t/t4018/matlab-function\nnew file mode 100644\nindex 0000000000..897a9b13ff\n--- /dev/null\n+++ b/t/t4018/matlab-function\n@@ -0,0 +1,4 @@\n+function y = RIGHT()\n+x = 5;\n+y = ChangeMe + x;\n+end\ndiff --git a/t/t4018/matlab-octave-section-1 b/t/t4018/matlab-octave-section-1\nnew file mode 100644\nindex 0000000000..3bb6c4670e\n--- /dev/null\n+++ b/t/t4018/matlab-octave-section-1\n@@ -0,0 +1,3 @@\n+%%% RIGHT section\n+# this is octave script\n+ChangeMe = 1;\ndiff --git a/t/t4018/matlab-octave-section-2 b/t/t4018/matlab-octave-section-2\nnew file mode 100644\nindex 0000000000..ab2980f7f2\n--- /dev/null\n+++ b/t/t4018/matlab-octave-section-2\n@@ -0,0 +1,3 @@\n+## RIGHT section\n+# this is octave script\n+ChangeMe = 1;\ndiff --git a/t/t4018/matlab-section b/t/t4018/matlab-section\nnew file mode 100644\nindex 0000000000..5ea59a5de0\n--- /dev/null\n+++ b/t/t4018/matlab-section\n@@ -0,0 +1,3 @@\n+%% RIGHT section\n+% this is understood by both matlab and octave\n+ChangeMe = 1;\ndiff --git a/userdiff.c b/userdiff.c\nindex 3a78fbf504..04270fb4d7 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -58,7 +58,12 @@ PATTERNS(\"java\",\n \t \"|[-+*/<>%&^|=!]=\"\n \t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n PATTERNS(\"matlab\",\n-\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$\",\n+\t /*\n+\t  * Octave pattern is mostly the same as matlab, except that '%%%' and\n+\t  * '##' can also be used to begin code sections, in addition to '%%'\n+\t  * that is understood by both.\n+\t  */\n+\t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n \t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n PATTERNS(\"objc\",\n \t /* Negate C statements that can look like functions */\n-- \n2.21.0.777.g83232e3864\n\n"},{"id":"376317","messageId":"xmqqpno24jtf.fsf@gitster-ct.c.googlers.com","threadId":"51064","inReplyTo":"3b7a22e8-0310-3738-0476-b6d73f187331@kdbg.org","subject":"Re: [PATCH v5] userdiff: add Octave","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-05-28T16:37:00Z","receivedAt":"2019-05-28T16:37:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Junio will very likely appreciate if you resend with these fixes applied.\n\nHeh, thanks, for spotting, but this round has already been in 'next'\nso any updates should be done incrementally X-<.\n"},{"id":"376347","messageId":"1c31f3fc-9283-91ef-7c96-6eed2f010491@kdbg.org","threadId":"51064","inReplyTo":"xmqqpno24jtf.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v5] userdiff: add Octave","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-05-28T20:26:16Z","receivedAt":"2019-05-28T20:26:22Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 28.05.19 um 18:37 schrieb Junio C Hamano:\n> Johannes Sixt <j6t@kdbg.org> writes:\n> \n>> Junio will very likely appreciate if you resend with these fixes applied.\n> \n> Heh, thanks, for spotting, but this round has already been in 'next'\n> so any updates should be done incrementally X-<.\n> \n\nI don't terribly mind the small grammatic weakness and the style\nviolation. No further action required from my point of view.\n\n-- Hannes\n"},{"id":"376401","messageId":"20190529161539.47445-1-liboxuan@connect.hku.hk","threadId":"51064","inReplyTo":"1c31f3fc-9283-91ef-7c96-6eed2f010491@kdbg.org","subject":"[PATCH] userdiff: fix grammar and style issues","fromName":"Boxuan Li","fromEmail":"liboxuan@connect.hku.hk","sentAt":"2019-05-29T16:15:39Z","receivedAt":"2019-05-29T16:16:03Z","isPatch":true,"sender":{"key":"liboxuan@connect.hku.hk","avatar":"https://avatars.githubusercontent.com/u/25746010?v=4"},"body":"Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>\n---\nBased on 'next' branch\n---\n Documentation/gitattributes.txt | 2 +-\n userdiff.c                      | 6 ++++--\n 2 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex ade5e6d400..2796dfc83b 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -819,7 +819,7 @@ patterns are available:\n \n - `java` suitable for source code in the Java language.\n \n-- `matlab` suitable for source code in the MATLAB and Octave language.\n+- `matlab` suitable for source code in the MATLAB and Octave languages.\n \n - `objc` suitable for source code in the Objective-C language.\n \ndiff --git a/userdiff.c b/userdiff.c\nindex 5a3bff3836..a47b24b320 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -58,9 +58,11 @@ PATTERNS(\"java\",\n \t \"|[-+*/<>%&^|=!]=\"\n \t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n PATTERNS(\"matlab\",\n-\t /* Octave pattern is mostly the same as matlab, except that '%%%' and\n+\t /*\n+\t  * Octave pattern is mostly the same as matlab, except that '%%%' and\n \t  * '##' can also be used to begin code sections, in addition to '%%'\n-\t  * that is understood by both. */\n+\t  * that is understood by both.\n+\t  */\n \t \"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$\",\n \t \"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\\\.[*/\\\\^']|\\\\|\\\\||&&\"),\n PATTERNS(\"objc\",\n-- \n2.21.0.777.g83232e3864\n\n"}]}