Skip to content

Commit cb42d4a

Browse files
committed
cmd/git(fix[GitRemoteManager.ls]): Handle URLs with spaces
why: The regex pattern used \S+ for URLs which failed to match paths containing spaces (e.g., /tmp/foo bar), causing those remotes to be silently dropped from the listing. what: - Change URL pattern from \S+ to .+? (non-greedy any char) - Add line anchors (^ and $) for proper multiline matching - Non-greedy ensures we stop at the (fetch|push) suffix
1 parent eda818c commit cb42d4a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/libvcs/cmd/git.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4377,11 +4377,13 @@ def ls(self) -> QueryList[GitRemoteCmd]:
43774377
remote_str = self._ls()
43784378
remote_pattern = re.compile(
43794379
r"""
4380+
^ # Start of line
43804381
(?P<name>\S+) # Remote name: one or more non-whitespace characters
4381-
\s+ # One or more whitespace characters
4382-
(?P<url>\S+) # URL: one or more non-whitespace characters
4382+
\s+ # One or more whitespace characters (tab separator)
4383+
(?P<url>.+?) # URL: any characters (non-greedy) - supports spaces
43834384
\s+ # One or more whitespace characters
43844385
\((?P<cmd_type>fetch|push)\) # 'fetch' or 'push' in parentheses
4386+
$ # End of line
43854387
""",
43864388
re.VERBOSE | re.MULTILINE,
43874389
)

0 commit comments

Comments
 (0)