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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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).

On 03/15, jkapil.cs@xxxxxxxxx wrote:
> From: Kapil <jkapil.cs@xxxxxxxxx>

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

> 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".

> 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.

> 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/20170329165331.17742-1-pickfire@xxxxxxxxxx/#t

> ---
>  t/t4018-diff-funcname.sh | 1 +
>  t/t4034-diff-words.sh    | 1 +
>  userdiff.c               | 5 +++++
>  3 files changed, 7 insertions(+)
> 
> diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
> index 22f9f88f0a..68092eaeaa 100755
> --- a/t/t4018-diff-funcname.sh
> +++ b/t/t4018-diff-funcname.sh
> @@ -44,6 +44,7 @@ diffpatterns="
>  	python
>  	ruby
>  	tex
> +	shell
>  	custom1
>  	custom2
>  	custom3
> diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
> index 912df91226..de21f36d97 100755
> --- a/t/t4034-diff-words.sh
> +++ b/t/t4034-diff-words.sh
> @@ -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 &&
> diff --git a/userdiff.c b/userdiff.c
> index 3a78fbf504..1743608da2 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -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
> -- 
> 2.14.2
> 



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux