]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0836: filetype: .git-blame-ignore-revs file is not recognized v9.2.0836
authorFionn Fitzmaurice <fionn@github.com>
Wed, 22 Jul 2026 19:49:58 +0000 (19:49 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 22 Jul 2026 19:52:22 +0000 (19:52 +0000)
Problem:  filetype: .git-blame-ignore-revs file is not recognized
Solution: Detect .git-blame-ignore-revs file as gitrevlist filetype,
          include syntax and filetype plugins (Fionn Fitzmaurice)

A Git revision list is

> a list of object names (i.e. one unabbreviated SHA-1 per line)...,
> comments (#), empty lines, and any leading and trailing whitespace are
> ignored.

(from Git's fsck.skipList documentation).

The default output of git rev-list will match this. It is also suitable
as input to git blame --ignore-revs-file.

This adds filetype detection matching .git-blame-ignore-revs files,
syntax highlighting and basic filetype settings.

closes: #20702

Signed-off-by: Fionn Fitzmaurice <fionn@github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
.github/MAINTAINERS
runtime/autoload/dist/ft.vim
runtime/ftplugin/gitrevlist.vim [new file with mode: 0644]
runtime/syntax/gitrevlist.vim [new file with mode: 0644]
src/testdir/test_filetype.vim
src/version.c

index 880414e2992b8a70ce850da69e2d84b9db9e2452..ea7682488035dc87e03d988f297343a871f5bef3 100644 (file)
@@ -206,6 +206,7 @@ runtime/ftplugin/gitcommit.vim                              @tpope
 runtime/ftplugin/gitconfig.vim                         @tpope
 runtime/ftplugin/gitignore.vim                         @ObserverOfTime
 runtime/ftplugin/gitrebase.vim                         @tpope
+runtime/ftplugin/gitrevlist.vim                                @fionn
 runtime/ftplugin/gitsendemail.vim                      @tpope
 runtime/ftplugin/gleam.vim                             @kirillmorozov
 runtime/ftplugin/go.vim                                        @dbarnett
index 7473896b064830a818a07976adb9101127e8b9ec..25414c490cba913184c1073a5a4758af28e72c80 100644 (file)
@@ -3,7 +3,7 @@ vim9script
 # Vim functions for file type detection
 #
 # Maintainer:          The Vim Project <https://github.com/vim/vim>
-# Last Change:         2026 Jul 21
+# Last Change:         2026 Jul 22
 # Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 # These functions are moved here from runtime/filetype.vim to make startup
@@ -3271,6 +3271,8 @@ const ft_from_name = {
   "TAG_EDITMSG": "gitcommit",
   "NOTES_EDITMSG": "gitcommit",
   "EDIT_DESCRIPTION": "gitcommit",
+  # Git revision list
+  ".git-blame-ignore-revs": "gitrevlist",
   # gnash(1) configuration files
   "gnashrc": "gnash",
   ".gnashrc": "gnash",
diff --git a/runtime/ftplugin/gitrevlist.vim b/runtime/ftplugin/gitrevlist.vim
new file mode 100644 (file)
index 0000000..6282203
--- /dev/null
@@ -0,0 +1,16 @@
+" Vim filetype plugin file
+" Language:     Git revision list
+" Author:       Fionn Fitzmaurice (github.com/fionn)
+" Maintainer:   Fionn Fitzmaurice (github.com/fionn)
+" License:      Vim & Apache 2.0
+
+if exists("b:did_ftplugin")
+    finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=:#
+setlocal commentstring=#\ %s
+setlocal keywordprg=git\ show
+
+let b:undo_ftplugin = "setl comments< commentstring< keywordprg<"
diff --git a/runtime/syntax/gitrevlist.vim b/runtime/syntax/gitrevlist.vim
new file mode 100644 (file)
index 0000000..11b4b0a
--- /dev/null
@@ -0,0 +1,17 @@
+" Vim syntax file
+" Language:     Git revision list
+" Author:       Fionn Fitzmaurice (github.com/fionn)
+" Maintainer:   Fionn Fitzmaurice (github.com/fionn)
+" License:      Vim & Apache 2.0
+
+if exists("b:current_syntax")
+    finish
+endif
+
+syn match gitrevlistHash "\<\x\{40}\>\|\<\x\{64}\>" contains=@NoSpell nextgroup=gitrevlistComment skipwhite
+syn match gitrevlistComment "#.*$"
+
+hi def link gitrevlistHash Identifier
+hi def link gitrevlistComment Comment
+
+let b:current_syntax = "gitrevlist"
index 79ce8ff9c4c64c3e4347d52056720e84ac4c4938..4c03d5f5086c8fb418f8cdab9b32d4cb21368f78 100644 (file)
@@ -337,6 +337,7 @@ def s:GetFilenameChecks(): dict<list<string>>
     gitignore: ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'] + WhenConfigHome('$XDG_CONFIG_HOME/git/ignore') + ['.prettierignore', '.fdignore', '/.config/fd/ignore', '.ignore', '.rgignore', '.dockerignore', '.containerignore', '.npmignore', '.vscodeignore'],
     gitolite: ['gitolite.conf', '/gitolite-admin/conf/file', 'any/gitolite-admin/conf/file'],
     gitrebase: ['git-rebase-todo'],
+    gitrevlist: ['.git-blame-ignore-revs'],
     gitsendemail: ['.gitsendemail.msg.xxxxxx'],
     gkrellmrc: ['gkrellmrc', 'gkrellmrc_x'],
     gleam: ['file.gleam'],
index ac615f9b9a71a6ef704d9d56649680eb0a0d9fef..d81425099475eca66671b593718028f18213926e 100644 (file)
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    836,
 /**/
     835,
 /**/