Skip to content

Skip a remote with no URL when listing remotes [patch] - #208

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/175-remote-without-url
Oct 13, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/175-remote-without-url

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #175

What was wrong

git remote -v lists a remote.<name>.* config section that has no url as name<TAB>, with nothing after the tab. You get one from a global remote.origin.prune=true in a repository without an origin. GitRemoteParser threw GitParseException on that line, so Remotes() failed for the whole repository and dropped the valid remotes along with it.

Change

  • GitRemoteParser.Parse now skips a line whose text after the tab is empty, which matches git treating such a remote as non-existent. Every other malformed line still throws.
  • Parser test: "origin\t\nupstream\thttps://x (fetch)\nupstream\thttps://x (push)\n" returns only upstream.
  • Integration test: a temp repository with remote.ghost.prune=true and no URL gets an empty list from Remotes(), with no exception.

Verification

  • Both new tests fail with the parser change reverted and pass with it.
  • Full suite: dotnet test passed 802 of 802.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KLFPeLz9EhDwj3AmatpfG6


Generated by Claude Code

git remote -v lists a remote.<name>.* section that has no url as the name
and a bare tab. The parser rejected that line, so a global
remote.origin.prune=true made Remotes() throw in every repository without an
origin. git treats such a remote as non-existent, so the parser now skips it.

Fixes #175

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KLFPeLz9EhDwj3AmatpfG6

Copy link
Copy Markdown
Contributor Author

ci / .NET / Test on macos-latest (run 38341576299) sat in its Test step for about 53 minutes with no result. I cancelled it and queued one re-run.

I don't think the hang comes from this PR. The other workflow's Test on macos-latest ran the same test suite on the same commit (1739ad5), including the new Remotes() tests, and passed in about 3 minutes. The CI macOS jobs on #209 and #210 also passed. If the re-run hangs too, I'll treat it as a real failure and investigate it.


Generated by Claude Code

@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 7355425 into main Oct 13, 2026
21 of 24 checks passed
@matt-edmondson
matt-edmondson deleted the fix/175-remote-without-url branch October 13, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remotes() throws GitParseException when any remote section has no URL (e.g. global remote.origin.prune=true in a repo without origin)

2 participants