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

Issue:
git log merges in git-console
### Description

highlight merge lines in `git log`:

```
commit 362fdb88072ca0259e9f6e0251b47af4d75e141c
Merge: 8456fa3 722568d
```


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 043250a..35eb6a7 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,6 +4,8 @@ Changelog
 
 * Support hint, error, and fatal lines in ``git-console``.
 
+* Fix ``commit`` lines and support ``Merge:`` lines in ``git-console``.
+
 1.3.0 (2023-04-17)
 ------------------
 
diff --git a/src/pygments_git/__init__.py b/src/pygments_git/__init__.py
index 2a06b3d..31396a0 100644
--- a/src/pygments_git/__init__.py
+++ b/src/pygments_git/__init__.py
@@ -215,12 +215,11 @@ class GitBashSessionLexer(RegexLexer):
             ),
             # git log
             (
-                r"^(commit)( )([0-9a-f]{40})( )(\(.*?\))?$",
+                r"^(commit)( )([0-9a-f]{40})( \(.*?\))?$",
                 bygroups(  # type: ignore [no-untyped-call]
                     Generic.Subheading,
                     Generic.Output,
                     Number.Hex,
-                    Generic.Output,
                     Name.Label,
                 ),
             ),
@@ -238,6 +237,20 @@ class GitBashSessionLexer(RegexLexer):
                     String.Symbol,
                 ),
             ),
+            (
+                r"""(?x)
+                    ^
+                    (Merge:)
+                    (\ +)
+                    (.*)
+                    $
+                """,
+                bygroups(  # type: ignore [no-untyped-call]
+                    Keyword.Declaration,
+                    Generic.Output,
+                    Number.Hex,
+                ),
+            ),
             (
                 r"""(?xi)
                     ^


Test patch:
diff --git a/tests/index.html b/tests/index.html
index 08d10de..b5a7abc 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -279,6 +279,14 @@ <h2 id=test_git_console>
 -twisted
 +bopped
 
+$ git show 362fdb8
+commit 362fdb88072ca0259e9f6e0251b47af4d75e141c
+Merge: 8456fa3 722568d
+Author: A Hacker &lt;hacker9001@funmail.example&gt;
+Date:   ...
+
+    Merge branch &#x27;jig&#x27;
+
 $ git commit -m &quot;Spin it&quot;
 [main 0bcdb8f] Spin it
 
@@ -317,7 +325,7 @@ <h2 id=test_git_console>
 <span class="go">* </span><span class="mh">187c021</span><span class="go"> Initial commit</span>
 
 <span class="gp">$ </span>git<span class="w"> </span>log<span class="w"> </span>--patch<span class="w"> </span>-n<span class="w"> </span><span class="m">1</span>
-<span class="gu">commit</span><span class="go"> </span><span class="mh">0e87b4d49a0c48fd29b1b1c400ac7ebeabeb535d</span><span class="go"> </span><span class="nl">(HEAD -&gt; main)</span>
+<span class="gu">commit</span><span class="go"> </span><span class="mh">0e87b4d49a0c48fd29b1b1c400ac7ebeabeb535d</span><span class="nl"> (HEAD -&gt; main)</span>
 <span class="kd">Author:</span><span class="go"> </span><span class="ss">A Hacker &lt;hacker@example.com&gt;</span>
 <span class="kd">Date:</span><span class="go">   </span><span class="ss">Tue Apr 4 11:32:10 2023 +0100</span>
 
@@ -333,6 +341,14 @@ <h2 id=test_git_console>
 <span class="gd">-twisted</span>
 <span class="gi">+bopped</span>
 
+<span class="gp">$ </span>git<span class="w"> </span>show<span class="w"> </span>362fdb8
+<span class="gu">commit</span><span class="go"> </span><span class="mh">362fdb88072ca0259e9f6e0251b47af4d75e141c</span>
+<span class="kd">Merge:</span><span class="go"> </span><span class="mh">8456fa3 722568d</span>
+<span class="kd">Author:</span><span class="go"> </span><span class="ss">A Hacker &lt;hacker9001@funmail.example&gt;</span>
+<span class="kd">Date:</span><span class="go">   </span><span class="ss">...</span>
+
+<span class="go">    Merge branch 'jig'</span>
+
 <span class="gp">$ </span>git<span class="w"> </span>commit<span class="w"> </span>-m<span class="w"> </span><span class="s2">"Spin it"</span>
 <span class="nl">[main </span><span class="mh">0bcdb8f</span><span class="nl">]</span><span class="go"> Spin it</span>
 
diff --git a/tests/test_pygments_git.py b/tests/test_pygments_git.py
index f321c27..c35a1bc 100644
--- a/tests/test_pygments_git.py
+++ b/tests/test_pygments_git.py
@@ -242,6 +242,14 @@ def test_git_console(golden_file):
         -twisted
         +bopped
 
+        $ git show 362fdb8
+        commit 362fdb88072ca0259e9f6e0251b47af4d75e141c
+        Merge: 8456fa3 722568d
+        Author: A Hacker <hacker9001@funmail.example>
+        Date:   ...
+
+            Merge branch 'jig'
+
         $ git commit -m "Spin it"
         [main 0bcdb8f] Spin it