Repository: adamchainz/pygments-git (language: python)

Issue:
`.git-blame-ignore-revs` support
### Description

Really simple format: https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index e41813f..78f46e3 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -2,6 +2,8 @@
 Changelog
 =========
 
+* Add ``git-blame-ignore-revs`` lexer.
+
 1.6.0 (2023-07-10)
 ------------------
 
diff --git a/README.rst b/README.rst
index 73edca4..cb41d92 100644
--- a/README.rst
+++ b/README.rst
@@ -57,6 +57,15 @@ Within Sphinx/docutils, you can refer to them in ``code-block`` directives:
 
 To preview the lexers, open the ``tests/index.html`` file within the repository.
 
+``git-blame-ignore-revs``
+-------------------------
+
+A lexer for the file format used by |blame.ignoreRevsFile|__.
+The de facto name for a repository-wide ignore file is ``.git-blame-ignore-revs``, as recognized `by GitHub <https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view>`__ and potentially other Git hosting services.
+
+.. |blame.ignoreRevsFile| replace:: ``blame.ignoreRevsFile``
+__ https://git-scm.com/docs/git-blame#Documentation/git-blame.txt-blameignoreRevsFile
+
 ``git-commit-edit-msg``
 -----------------------
 
diff --git a/setup.cfg b/setup.cfg
index ddb3c7b..8b9f48e 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -45,6 +45,7 @@ where = src
 [options.entry_points]
 pygments.lexers =
     git-attributes=pygments_git:GitAttributesLexer
+    git-blame-ignore-revs=pygments_git:GitBlameIgnoreRevsLexer
     git-commit-edit-msg=pygments_git:GitCommitEditMsgLexer
     git-conflict-markers=pygments_git:GitConflictMarkersLexer
     git-console=pygments_git:GitBashSessionLexer
diff --git a/src/pygments_git/__init__.py b/src/pygments_git/__init__.py
index b693bbd..5ab2b61 100644
--- a/src/pygments_git/__init__.py
+++ b/src/pygments_git/__init__.py
@@ -51,6 +51,20 @@ class GitAttributesLexer(RegexLexer):
     }
 
 
+class GitBlameIgnoreRevsLexer(RegexLexer):
+    name = "Git Blame Ignore Revs"
+    aliases = ("git-blame-ignore-revs",)
+    flags = re.MULTILINE
+
+    tokens = {
+        "root": [
+            (r"^#.*$", Comment),
+            (r"^([0-9a-f]{40,})$", Number.Hex),
+            (r"^.*\n", Generic.Error),
+        ],
+    }
+
+
 class GitCommitEditMsgLexer(RegexLexer):
     name = "Git Commit Edit-Msg"
     aliases = ("git-commit-edit-msg",)


Test patch:
diff --git a/tests/index.html b/tests/index.html
index 898fed9..2cdc90e 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -36,6 +36,7 @@
 .highlight .cs { color: #cc0000; font-weight: bold } /* Comment.Special */
 .highlight .gd { color: #A00000 } /* Generic.Deleted */
 .highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
 .highlight .gr { color: #FF0000 } /* Generic.Error */
 .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
 .highlight .gi { color: #00A000 } /* Generic.Inserted */
@@ -125,6 +126,25 @@ <h2 id=test_git_attributes>
 <span class="l">*.ps1</span> <span class="nv">text working-tree-encoding</span><span class="o">=</span><span class="ss">UTF-16LE</span><span class="nv"> eol</span><span class="o">=</span><span class="ss">CRLF</span>
 </pre></div>
 </div>
+<h2 id=test_git_blame_ignore_revs>
+test_git_blame_ignore_revs
+<a href=#test_git_blame_ignore_revs>#</a>
+</h2>
+<p>
+Lexer: git-blame-ignore-revs
+</p>
+<div class=compare><code>
+<pre>
+# Reformatted with Black
+a8940f7fbddf7fad9d7d50014d4e8d46baf30591
+woops forgot to comment this line
+</pre>
+</code>
+<div class="highlight"><pre><span></span><span class="c"># Reformatted with Black</span>
+<span class="mh">a8940f7fbddf7fad9d7d50014d4e8d46baf30591</span>
+<span class="gr">woops forgot to comment this line</span>
+</pre></div>
+</div>
 <h2 id=test_git_commit_edit_msg>
 test_git_commit_edit_msg
 <a href=#test_git_commit_edit_msg>#</a>
diff --git a/tests/test_pygments_git.py b/tests/test_pygments_git.py
index a0eb7cd..13b1d9d 100644
--- a/tests/test_pygments_git.py
+++ b/tests/test_pygments_git.py
@@ -142,6 +142,18 @@ def test_git_attributes(golden_file):
     )
 
 
+def test_git_blame_ignore_revs(golden_file):
+    golden_file.check(
+        "test_git_blame_ignore_revs",
+        "git-blame-ignore-revs",
+        """\
+        # Reformatted with Black
+        a8940f7fbddf7fad9d7d50014d4e8d46baf30591
+        woops forgot to comment this line
+        """,
+    )
+
+
 def test_git_commit_edit_msg(golden_file):
     golden_file.check(
         "test_git_commit_edit_msg",