[PATCH b4] Prevent interpreting usebranch as a path in find_cover_commit

Jacob Keller <[email protected]>
Newsgroups org.kernel.linux.tools
Message-ID <20260513-jk-dont-interpret-branch-as-filename-v1-1-220e7b8b006d@intel.com>
b4 can become very confused if the current branch name happens to also be
the same as a file in the root of the repository. When that happens, the
find_cover_commit() function will execute a git log command that can
accidentally interpret the usebranch value as the path. This results in b4
being unable to identify the cover commit, and assuming the branch is
unmanaged.

Fix this by adding an explicit '--' argument which ensures that git will
disambiguate and never interpret the branch argument as a file name.

This addition is sufficient to resolve my case where I had exported the
patch series using b4 send -o to a directory with the same name as the
branch. It is likely that other git invocation sin the b4 codebase could
benefit from explicit separators, but I did not go digging.

Signed-off-by: Jacob Keller <[email protected]>
---
 src/b4/ez.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/b4/ez.py b/src/b4/ez.py
index 3e81138e2dfe..d1e2fba76ea9 100644
--- a/src/b4/ez.py
+++ b/src/b4/ez.py
@@ -902,6 +902,7 @@ def find_cover_commit(usebranch: Optional[str] = None) -> Optional[str]:
         '--no-mailmap',
         f'--committer={limit_committer}',
         usebranch,
+        '--',
     ]
     lines = b4.git_get_command_lines(None, gitargs)
     if not lines:

---
base-commit: d5d981426ead3f490713ef5d2fd1aa3d0f13b005
change-id: 20260513-jk-dont-interpret-branch-as-filename-e4cbba6f400f

Best regards,
--  
Jacob Keller <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.