Skip to contentSkip to conversation

[GSoC][RFC/PATCH 0/1]

PATCH In review [email protected] 2 participants 5 messages Mar 15, 2019 – Mar 16, 2019 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover [GSoC][RFC/PATCH 0/1]

From: Kapil <[email protected]>

Kapil (1):
userdiff - support shell script

 t/t4018-diff-funcname.sh | 1 +
 t/t4034-diff-words.sh    | 1 +
 userdiff.c               | 5 +++++
 3 files changed, 7 insertions(+)
Signature · 1 line
2.14.2
#1 lore raw

PATCH 1/1 userdiff - support shell script

From: Kapil <[email protected]>

Made a minor change of adding regex for identifying functions in shell scripts. This regex has been tested separately from git.
For testing with git, please let me know.

This is just to get familiar with whole workflow, regex for word_regex parameter will be added in next patch.

---
 t/t4018-diff-funcname.sh | 1 +
 t/t4034-diff-words.sh    | 1 +
 userdiff.c               | 5 +++++
 3 files changed, 7 insertions(+)
t/t4018-diff-funcname.sh +1 -0
index 22f9f88f0a..68092eaeaa 100755
@@ -44,6 +44,7 @@ diffpatterns="
 	python
 	ruby
 	tex
+	shell
 	custom1
 	custom2
 	custom3
t/t4034-diff-words.sh +1 -0
index 912df91226..de21f36d97 100755
@@ -314,6 +314,7 @@ test_language_driver php
 test_language_driver python
 test_language_driver ruby
 test_language_driver tex
+test_language_driver shell
 
 test_expect_success 'word-diff with diff.sbe' '
 	cat >expect <<-\EOF &&
userdiff.c +5 -0
index 3a78fbf504..1743608da2 100644
@@ -170,6 +170,11 @@ IPATTERN("css",
 	 "-?[_a-zA-Z][-_a-zA-Z0-9]*" /* identifiers */
 	 "|-?[0-9]+|\\#[0-9a-fA-F]+" /* numbers */
 ),
+
+PATTERNS("shell",
+	"([A-Za-z_][A-Za-z0-9_]*)[[:space:]]*\\([[:space:]]*\\)[[:space:]]*\\{[[:space:]\\(\\)|\\[<>?`/~!:\'\"%^&*+A-Za-z0-9_$=@;#,.-]*\\}",
+	".*"
+),
 { "default", NULL, -1, { NULL, 0 } },
 };
 #undef PATTERNS
Signature · 1 line
2.14.2
#2 lore raw

Re: [GSoC][RFC/PATCH 1/1] userdiff - support shell script

Quoted 1 line

Subject: [GSoC][RFC/PATCH 1/1] userdiff - support shell script

We usually have the subject in the format "<area>: <short explanation>", so in this case it could be "userdiff: support shell script" (without the quotes of course).

Quoted 1 line · On 03/15, [email protected] wrote:

From: Kapil <[email protected]>

Ideally the name you are using for your contribution should be your full name, including your last name.

Quoted 1 line

Made a minor change of adding regex for identifying functions in shell scripts.

The commit message should be in the imperative mood, see also Documentation/SubmittingPatches. In addition the "minor change" bit should be omitted, as it doesn't add any actual value to the commit message.

So the above should just be "Add regex for identifying functions in shell scripts".

Quoted 2 lines

This regex has been tested separately from git.
For testing with git, please let me know.

For testing you could have a look how other userdiff drivers are tested in t4034. The easiest way is probably to have a look at a patch for a userdiff pattern that was added previously. For example have a look at 0719f3eecd ("userdiff: add built-in pattern for CSS", 2016-06-03). (I found this commit by looking at the git blame output for t4034.)

Both the two lines above and the line below should go below the --- line, as they should not be part of the history in the git project, but serve only as additional commentary for reviewers looking at this patch.

Quoted 1 line

This is just to get familiar with whole workflow, regex for word_regex parameter will be added in next patch.

There should be a Signed-off-by: line here. For its significance please see Documentation/SubmittingPatches.

Another thing you should consider is whether someone attempted to add support for this before. And indeed a quick search through public-inbox turns up [*1*]. It's always worth having a look at previous work, and things that can be learned from that.

*1*: https://public-inbox.org/git/[email protected]/#t

Quoted 49 lines
---
 t/t4018-diff-funcname.sh | 1 +
 t/t4034-diff-words.sh    | 1 +
 userdiff.c               | 5 +++++
 3 files changed, 7 insertions(+)
t/t4018-diff-funcname.sh +1 -0
index 22f9f88f0a..68092eaeaa 100755
@@ -44,6 +44,7 @@ diffpatterns="
 	python
 	ruby
 	tex
+	shell
 	custom1
 	custom2
 	custom3
t/t4034-diff-words.sh +1 -0
index 912df91226..de21f36d97 100755
@@ -314,6 +314,7 @@ test_language_driver php
 test_language_driver python
 test_language_driver ruby
 test_language_driver tex
+test_language_driver shell
 
 test_expect_success 'word-diff with diff.sbe' '
 	cat >expect <<-\EOF &&
userdiff.c +5 -0
index 3a78fbf504..1743608da2 100644
@@ -170,6 +170,11 @@ IPATTERN("css",
 	 "-?[_a-zA-Z][-_a-zA-Z0-9]*" /* identifiers */
 	 "|-?[0-9]+|\\#[0-9a-fA-F]+" /* numbers */
 ),
+
+PATTERNS("shell",
+	"([A-Za-z_][A-Za-z0-9_]*)[[:space:]]*\\([[:space:]]*\\)[[:space:]]*\\{[[:space:]\\(\\)|\\[<>?`/~!:\'\"%^&*+A-Za-z0-9_$=@;#,.-]*\\}",
+	".*"
+),
 { "default", NULL, -1, { NULL, 0 } },
 };
 #undef PATTERNS
Signature · 1 line
2.14.2

A message that is not in the archive (sent off-list or not yet received): CAMknYEP3dp0a9B4ZW5F8kt+rrRZagWaVYBMhYRWj68UgYrF-GA@mail.gmail.com

#4 lore raw

Re: [GSoC][RFC/PATCH 1/1] userdiff - support shell script

[please keep everyone in Cc, especially the mailing list if you are responding to review comments. I added the Cc's back]

Quoted 17 lines · Kapil Jain
Quoted 8 lines · Thomas Gummerer

For testing you could have a look how other userdiff drivers are tested in t4034. The easiest way is probably to have a look at a patch for a userdiff pattern that was added previously. For example have a look at 0719f3eecd ("userdiff: add built-in pattern for CSS", 2016-06-03). (I found this commit by looking at the git blame output for t4034.)
*1*: https://public-inbox.org/git/[email protected]/#t

Thanks, this helped in understanding testing process.

Quoted 4 lines

Both the two lines above and the line below should go below the --- line, as they should not be part of the history in the git project, but serve only as additional commentary for reviewers looking at this patch.

Quoted 4 lines

I looked at other patches like
(https://public-inbox.org/git/CAC05386q2iGoiJ_fRgwoOTF23exEN2D1+oh4VjajEvYQ58O1TQ@mail.gmail.com/)
The patch has the email body above --- line. did i missed to understanding something here ?

Right, what I was trying but failed to explain is that everything above the --- line is part of the commit message, that gets recorded in the history of the project.

However the lines I referred to, should not go in the commit message, as they are just commentary that helps reviewers, but don't actually explain the patch itself. That additional commentary should go below the --- line, similar to the

    Notes:
        Travis CI results: https://travis-ci.org/nbelakovski/git/builds/432320949

lines in the email you mentioned.

#5 lore raw
In reply to [email protected]
Quoted 2 lines · On 03/15, [email protected] wrote:

From: Kapil <[email protected]>

The cover letter should give reviewers a short introduction what a patch series is about. It's often not worth including a cover letter if there is only a single patch, or only a couple of patches.

It is okay to send a cover letter for a single patch, however it should include some explanation for the patch series, and not just duplicate what's said in the commit message of the actual patch. An empty cover letter as this one here is just noise, and should be omitted.

Quoted 11 lines

Kapil (1):
userdiff - support shell script

 t/t4018-diff-funcname.sh | 1 +
 t/t4034-diff-words.sh    | 1 +
 userdiff.c               | 5 +++++
 3 files changed, 7 insertions(+)
Signature · 1 line
2.14.2