Message ID | pull.902.git.1615667191368.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | userdiff: support Clojure | expand |
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index e84e104f9325..a7734d413758 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -807,6 +807,8 @@ patterns are available: - `bibtex` suitable for files with BibTeX coded references. +- `clojure` suitable for source code in the Clojure language. + - `cpp` suitable for source code in the C and C++ languages. - `csharp` suitable for source code in the C# language. diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index 9675bc17db27..f126a349aa24 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -29,6 +29,7 @@ diffpatterns=" ada bash bibtex + clojure cpp csharp css diff --git a/t/t4018/clojure-comment b/t/t4018/clojure-comment new file mode 100644 index 000000000000..5e20f41b554e --- /dev/null +++ b/t/t4018/clojure-comment @@ -0,0 +1,8 @@ +(comment ;; RIGHT rich comment + + +;; ignore comment + + + (do-something "ChangeMe")) + diff --git a/t/t4018/clojure-function b/t/t4018/clojure-function new file mode 100644 index 000000000000..347790fd37f7 --- /dev/null +++ b/t/t4018/clojure-function @@ -0,0 +1,6 @@ +(defn RIGHT + [] +; ignore comment + + (ChangeMe)) + diff --git a/t/t4018/clojure-ns b/t/t4018/clojure-ns new file mode 100644 index 000000000000..e3e2e5f4c986 --- /dev/null +++ b/t/t4018/clojure-ns @@ -0,0 +1,10 @@ +(ns RIGHT + +;; ignore comment + + (:require [some.lib :refer [ + + + ChangeMe + + ])) diff --git a/t/t4018/clojure-reader-comment b/t/t4018/clojure-reader-comment new file mode 100644 index 000000000000..f17e51074558 --- /dev/null +++ b/t/t4018/clojure-reader-comment @@ -0,0 +1,5 @@ +#_((def commented-RIGHT-definition + +; ignore comment + + ChangeMe)) diff --git a/userdiff.c b/userdiff.c index 3f81a2261c5e..887264081e3c 100644 --- a/userdiff.c +++ b/userdiff.c @@ -44,6 +44,17 @@ PATTERNS("bash", /* -- */ /* Characters not in the default $IFS value */ "[^ \t]+"), +PATTERNS("clojure", + /* Ignore comments */ + "!^;.*\n" + /* Top level forms */ + "^[^ \t].*$", + /* Atoms, Keywords, Symbols */ + "[#@:]?[^0-9][a-zA-Z0-9*+!-_'?<>=/.]+" + /* Numbers */ + "|[-]?[0-9a-fA-Frxb/MN]+" + /* Characters */ + "|[\\0-9a-fA-F]+"), PATTERNS("dts", "!;\n" "!=\n"