From 3177841bdf35168ea74b4b567d92aea1a17d58a6 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 6 Jul 2025 18:10:36 +0200 Subject: [PATCH] vim-patch:9.1.1517: filetype: autopkgtest files are not recognized Problem: filetype: autopkgtest files are not recognized Solution: detect */debian/tests/control files as autopkgtest filetype (James McCoy) Autopkgtest is a Debian tool for testing installed versions of packages when other, related packages are updated. Reference: - https://www.debian.org/doc/debian-policy/autopkgtest.txt related: vim/vim#17679 https://github.com/vim/vim/commit/5bcc492649f2d810577dd8dc4e1fb92f548847eb Co-authored-by: James McCoy --- runtime/lua/vim/filetype.lua | 1 + runtime/lua/vim/filetype/detect.lua | 2 ++ test/old/testdir/test_filetype.vim | 1 + 3 files changed, 4 insertions(+) diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 84322142d0..fcd2ea9acf 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1969,6 +1969,7 @@ local detect_xkb = starsetf('xkb') local pattern = { -- BEGIN PATTERN ['/debian/'] = { + ['/debian/tests/control$'] = 'autopkgtest', ['/debian/changelog$'] = 'debchangelog', ['/debian/control$'] = 'debcontrol', ['/debian/copyright$'] = 'debcopyright', diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 16c3c43446..07bb02029b 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -264,6 +264,8 @@ function M.control(_, bufnr) local line1 = getline(bufnr, 1) if line1 and findany(line1, { '^Source:', '^Package:' }) then return 'debcontrol' + elseif line1 and findany(line1, { '^Tests:', '^Test%-Command:' }) then + return 'autopkgtest' end end diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index b08eee9138..738e49e522 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -126,6 +126,7 @@ func s:GetFilenameChecks() abort \ 'autohotkey': ['file.ahk'], \ 'autoit': ['file.au3'], \ 'automake': ['GNUmakefile.am', 'makefile.am', 'Makefile.am'], + \ 'autopkgtest': ['/debian/tests/control', 'any/debian/tests/control'], \ 'ave': ['file.ave'], \ 'awk': ['file.awk', 'file.gawk'], \ 'b': ['file.mch', 'file.ref', 'file.imp'],