[PATCH b4 v2 19/44] ty: edit the thank-you review in the tree it was pointed at

Christian Brauner <[email protected]> Fri, 31 Jul 2026 23:59:00 +0200
Newsgroups org.kernel.linux.tools
Message-ID <20260731-work-b4-editor-branch-guard-v2-19-243fd19d322d@kernel.org>
interactive_ty_review() hands the gitdir "b4 ty -g" was given to
everything it calls except the editor, so the scratch file and the
core.editor lookup used the process cwd. Pass it there too.

Signed-off-by: Christian Brauner (Amutable) <[email protected]>
---
 src/b4/ty.py         |  4 +++-
 src/tests/test_ty.py | 10 +++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/b4/ty.py b/src/b4/ty.py
index 5e225a7..a23a339 100644
--- a/src/b4/ty.py
+++ b/src/b4/ty.py
@@ -582,7 +582,9 @@ def interactive_ty_review(
         sections.append((str(jsondata['subject']), details))
 
     buf = render_ty_review(sections)
-    edited = b4.edit_in_editor(buf, filehint='b4-ty-review.COMMIT_EDITMSG')
+    edited = b4.edit_in_editor(
+        buf, filehint='b4-ty-review.COMMIT_EDITMSG', topdir=gitdir
+    )
     try:
         skipped = parse_ty_review(edited, sections)
     except ValueError as ex:
diff --git a/src/tests/test_ty.py b/src/tests/test_ty.py
index ddf3d7e..ce299fc 100644
--- a/src/tests/test_ty.py
+++ b/src/tests/test_ty.py
@@ -1,7 +1,7 @@
 import os
 import pathlib
 from email.message import EmailMessage
-from typing import List, Optional, Tuple
+from typing import Any, List, Optional, Tuple
 
 import pytest
 
@@ -123,7 +123,9 @@ def test_interactive_ty_review_drops_skipped(monkeypatch: pytest.MonkeyPatch) ->
         },
     ]
 
-    def fake_edit(bdata: bytes, filehint: str = 'COMMIT_EDITMSG') -> bytes:
+    def fake_edit(
+        bdata: bytes, filehint: str = 'COMMIT_EDITMSG', **kwargs: Any
+    ) -> bytes:
         # Maintainer skips the pull request, keeps the patch series.
         text = bdata.decode('utf-8').replace('+ [GIT PULL]', 'x [GIT PULL]')
         return text.encode('utf-8')
@@ -157,7 +159,9 @@ def test_interactive_ty_review_keeps_all_when_pristine(
         },
     ]
 
-    def fake_edit(bdata: bytes, filehint: str = 'COMMIT_EDITMSG') -> bytes:
+    def fake_edit(
+        bdata: bytes, filehint: str = 'COMMIT_EDITMSG', **kwargs: Any
+    ) -> bytes:
         return bdata
 
     monkeypatch.setattr(b4, 'edit_in_editor', fake_edit)

-- 
2.53.0