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

[GSoC][RFC/PATCH 2/2] userdiff: added shell script support, clears test

From
KJKapil Jain <jkapil.cs@gmail.com>
Date
Mar 24, 2019, 08:45 UTC
Message-ID
<20190324084523.8744-1-jkapil.cs@gmail.com>
In-Reply-To
<CAP8UFD3K4ft7UVSFeaQzKVVGFPwcLcpTKB+sqFN9X9_j_A093w@mail.gmail.com>
Signed-off-by: Kapil Jain <jkapil.cs@gmail.com>
---

The test passes now, but imo the regex is not working, because the output of git diff with shell regex remains same as earlier it was without shell regex.

without shell regex the output was shown as: -$TEST_DIRECTORY +$TEST_DIR

with shell regex the output should be: [-$TEST_DIRECTORY-] {+$TEST_DIR+}

but even with shell regex the output is: -$TEST_DIRECTORY +$TEST_DIR

some thoughts on regex would be helpful. the shell regex is below:

+
+PATTERNS("shell",
+  /* Function Names */
+  "([A-Za-z_][A-Za-z0-9_]*)[[:space:]]*\\([[:space:]]*\\)[[:space:]]*\\{",
+  /* Words */
+  "([$#@A-Za-z_\"\'][$#@A-Za-z0-9_\"\']*)"),
+
Thanks.
 t/t4034/shell/expect | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t4034/shell/expect b/t/t4034/shell/expect
index f2f65e7a9b..1f0d1e1d43 100644
--- a/t/t4034/shell/expect
+++ b/t/t4034/shell/expect
@@ -1,6 +1,6 @@
 <BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index 2fc00ad..cd34305 100644<RESET>
+<BOLD>index 32440f9..43a84e0 100644<RESET>
 <BOLD>--- a/pre<RESET>
 <BOLD>+++ b/post<RESET>
 <CYAN>@@ -1 +1 @@<RESET>
-<RED>[-$TEST_DIRECTORY-]<RESET><GREEN>{+$TEST_DIR+}<RESET>
+<RED>$TEST_DIRECTORY<RESET><GREEN>$TEST_DIR<RESET>
-- 
2.20.1
Previous: Thomas Gummerer
Message 9 of 9 in “userdiff: added support for diffing shell scripts”
  1. Kapil JainMar 22, 2019
  2. Christian CouderMar 23, 2019
  3. Kapil JainMar 24, 2019
  4. Christian CouderMar 24, 2019
  5. Kapil JainMar 24, 2019
  6. Thomas GummererMar 28, 2019
  7. Kapil JainMar 29, 2019
  8. Thomas GummererMar 29, 2019
  9. [GSoC][RFC/PATCH 2/2] userdiff: added shell script support, clears testKapil Jain, Mar 24, 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.