diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2025-08-10 07:27:53 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-09 23:27:53 +0000 |
| commit | f79430e2ce2e952dc9a9e1ff54826ed4e45360da (patch) | |
| tree | 440b6cf3b85096068b2583c2c6c9c432e27bea7b /runtime/lua/vim | |
| parent | 77500c5ad5c628a1ba469c2a115c1de3fc8b818a (diff) | |
vim-patch:9.1.1615: diff format erroneously detected (#35276)
Problem: diff format erroneously detected
(Tomáš Janoušek)
Solution: Make the regex to detect normal diff format a bit stricter,
while at it, fix wrong test content from patch v9.1.1606
fixes: vim/vim#17946
https://github.com/vim/vim/commit/887b4981e7e929ce8676b1b524e47a7fb5a8288b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime/lua/vim')
| -rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 2ace52f4fc..f20f2a0ecd 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -2063,6 +2063,7 @@ local patterns_text = { -- Diff file: -- - "diff" in first line (context diff) -- - "Only in " in first line + -- - "34,35c34,35" normal diff format output -- - "--- " in first line and "+++ " in second line (unified diff). -- - "*** " in first line and "--- " in second line (context diff). -- - "# It was generated by makepatch " in the second line (makepatch diff). @@ -2071,7 +2072,7 @@ local patterns_text = { -- - "=== ", "--- ", "+++ " (bzr diff, common case) -- - "=== (removed|added|renamed|modified)" (bzr diff, alternative) -- - "# HG changeset patch" in first line (Mercurial export format) - ['^\\(diff\\>\\|Only in \\|\\d\\+\\(,\\d\\+\\)\\=[cda]\\d\\+\\>\\|# It was generated by makepatch \\|Index:\\s\\+\\f\\+\\r\\=$\\|===== \\f\\+ \\d\\+\\.\\d\\+ vs edited\\|==== //\\f\\+#\\d\\+\\|# HG changeset patch\\)'] = { + ['^\\(diff\\>\\|Only in \\|\\d\\+\\(,\\d\\+\\)\\=[cda]\\d\\+\\(,\\d\\+\\)\\=\\>$\\|# It was generated by makepatch \\|Index:\\s\\+\\f\\+\\r\\=$\\|===== \\f\\+ \\d\\+\\.\\d\\+ vs edited\\|==== //\\f\\+#\\d\\+\\|# HG changeset patch\\)'] = { 'diff', { vim_regex = true }, }, |
