aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-04-15 13:50:15 -0700
committerJunio C Hamano <gitster@pobox.com>2025-04-15 13:50:16 -0700
commit7b7fe0a898978618c36432f1f89b29cd412c7a23 (patch)
tree456501d1f3f81df9046ac65b41e27c681aff0acb
parentd5baf636a431c54d0f306ed98775797c171373b2 (diff)
parent43380056df44aed6e074689dc8bc940f9dc6e2c8 (diff)
downloadgit-7b7fe0a898978618c36432f1f89b29cd412c7a23.tar.gz
Merge branch 'lo/userdiff-gitconfig'
* lo/userdiff-gitconfig: userdiff: add builtin driver for INI files
-rw-r--r--t/t4018/ini-section5
-rw-r--r--t/t4018/ini-section-noindent5
-rw-r--r--t/t4018/ini-section-same-line4
-rw-r--r--t/t4018/ini-subsection12
-rw-r--r--t/t4018/ini-subsection-noindent12
-rw-r--r--userdiff.c4
6 files changed, 42 insertions, 0 deletions
diff --git a/t/t4018/ini-section b/t/t4018/ini-section
new file mode 100644
index 0000000000..c895ad9b4f
--- /dev/null
+++ b/t/t4018/ini-section
@@ -0,0 +1,5 @@
+[RIGHT]
+ # comment
+ ; comment
+ name = value
+ ChangeMe
diff --git a/t/t4018/ini-section-noindent b/t/t4018/ini-section-noindent
new file mode 100644
index 0000000000..733d23c801
--- /dev/null
+++ b/t/t4018/ini-section-noindent
@@ -0,0 +1,5 @@
+[RIGHT]
+# comment
+; comment
+name = value
+ChangeMe
diff --git a/t/t4018/ini-section-same-line b/t/t4018/ini-section-same-line
new file mode 100644
index 0000000000..522a1fa4a1
--- /dev/null
+++ b/t/t4018/ini-section-same-line
@@ -0,0 +1,4 @@
+[RIGHT] name = value
+ # comment
+ ; comment
+ ChangeMe
diff --git a/t/t4018/ini-subsection b/t/t4018/ini-subsection
new file mode 100644
index 0000000000..3d47349e60
--- /dev/null
+++ b/t/t4018/ini-subsection
@@ -0,0 +1,12 @@
+[LEFT]
+
+ [LEFT "CENTER"]
+ # comment
+ ; comment
+ name = value
+
+ [LEFT "RIGHT"]
+ # comment
+ ; comment
+ name = value
+ ChangeMe
diff --git a/t/t4018/ini-subsection-noindent b/t/t4018/ini-subsection-noindent
new file mode 100644
index 0000000000..698ea00ea3
--- /dev/null
+++ b/t/t4018/ini-subsection-noindent
@@ -0,0 +1,12 @@
+[LEFT]
+
+[LEFT "CENTER"]
+# comment
+; comment
+name = value
+
+[LEFT "RIGHT"]
+# comment
+; comment
+name = value
+ChangeMe
diff --git a/userdiff.c b/userdiff.c
index 340c4eb4f7..da75625020 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -211,6 +211,10 @@ PATTERNS("html",
"^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$",
/* -- */
"[^<>= \t]+"),
+PATTERNS("ini",
+ "^[ \t]*\\[[^]]+\\]",
+ /* -- */
+ "[^ \t]+"),
PATTERNS("java",
"!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
/* Class, enum, interface, and record declarations */