git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jjkapil.cs@gmail.com <jkapil.cs@gmail.com>
Date
Mar 15, 2019, 15:01 UTC
Message-ID
<20190315150142.20672-2-jkapil.cs@gmail.com>
In-Reply-To
<20190315150142.20672-1-jkapil.cs@gmail.com>
From: Kapil <jkapil.cs@gmail.com>

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(+)
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
Previous: jkapil.cs@gmail.comNext: Thomas Gummerer
Message 2 of 5 in “[GSoC][RFC/PATCH 0/1]”
  1. jkapil.cs@gmail.comMar 15, 2019
  2. [GSoC][RFC/PATCH 1/1] userdiff - support shell scriptjkapil.cs@gmail.com, Mar 15, 2019
  3. Thomas GummererMar 15, 2019
  4. Thomas GummererMar 15, 2019
  5. Thomas GummererMar 16, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.