git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kapil Jain <jkapil.cs@gmail.com>
To: git@vger.kernel.org
Cc: t.gummerer@gmail.com, Kapil Jain <jkapil.cs@gmail.com>
Subject: [GSoC][RFC/PATCH] userdiff: added support for diffing shell scripts
Date: Fri, 22 Mar 2019 21:36:15 +0530	[thread overview]
Message-ID: <20190322160615.27124-1-jkapil.cs@gmail.com> (raw)

Signed-off-by: Kapil Jain <jkapil.cs@gmail.com>
---

The test written does not pass, imo there's some problem with the regex part.
please let me know about the fault.

 t/t4034-diff-words.sh | 2 ++
 t/t4034/shell/expect  | 6 ++++++
 t/t4034/shell/post    | 1 +
 t/t4034/shell/pre     | 1 +
 userdiff.c            | 7 +++++++
 5 files changed, 17 insertions(+)
 create mode 100644 t/t4034/shell/expect
 create mode 100644 t/t4034/shell/post
 create mode 100644 t/t4034/shell/pre

diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 912df91226..74366e6826 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -314,6 +314,8 @@ 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/t/t4034/shell/expect b/t/t4034/shell/expect
new file mode 100644
index 0000000000..f2f65e7a9b
--- /dev/null
+++ b/t/t4034/shell/expect
@@ -0,0 +1,6 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 2fc00ad..cd34305 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1 +1 @@<RESET>
+<RED>[-$TEST_DIRECTORY-]<RESET><GREEN>{+$TEST_DIR+}<RESET>
diff --git a/t/t4034/shell/post b/t/t4034/shell/post
new file mode 100644
index 0000000000..43a84e0188
--- /dev/null
+++ b/t/t4034/shell/post
@@ -0,0 +1 @@
+$TEST_DIR
diff --git a/t/t4034/shell/pre b/t/t4034/shell/pre
new file mode 100644
index 0000000000..32440f90b7
--- /dev/null
+++ b/t/t4034/shell/pre
@@ -0,0 +1 @@
+$TEST_DIRECTORY
diff --git a/userdiff.c b/userdiff.c
index 3a78fbf504..936447a0bc 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -158,6 +158,13 @@ PATTERNS("csharp",
 	 "[a-zA-Z_][a-zA-Z0-9_]*"
 	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
 	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"),
+
+PATTERNS("shell",
+  /* Function Names */
+  "([A-Za-z_][A-Za-z0-9_]*)[[:space:]]*\\([[:space:]]*\\)[[:space:]]*\\{",
+  /* Words */
+  "([$#@A-Za-z_\"\'][$#@A-Za-z0-9_\"\']*)"),
+
 IPATTERN("css",
 	 "![:;][[:space:]]*$\n"
 	 "^[_a-z0-9].*$",
-- 
2.14.2


             reply	other threads:[~2019-03-22 16:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22 16:06 Kapil Jain [this message]
2019-03-23 20:04 ` [GSoC][RFC/PATCH] userdiff: added support for diffing shell scripts Christian Couder
2019-03-24  8:04   ` Kapil Jain
2019-03-24  9:19     ` Christian Couder
2019-03-24 10:04       ` Kapil Jain
2019-03-28 21:30         ` Thomas Gummerer
2019-03-29 12:13           ` Kapil Jain
2019-03-29 19:07             ` Thomas Gummerer
2019-03-24  8:45   ` [GSoC][RFC/PATCH 2/2] userdiff: added shell script support, clears test Kapil Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190322160615.27124-1-jkapil.cs@gmail.com \
    --to=jkapil.cs@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=t.gummerer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).