Skip to content

Conversation

@max-sixty
Copy link
Owner

Summary

  • Changed primary_remote() to return an error when no remotes are configured instead of falling back to a fictional "origin"
  • Updated callers to handle the no-remote case appropriately

Why: Returning "origin" when no remotes exist caused confusing downstream errors and made callers uncertain (hence redundant .unwrap_or("origin") patterns).

Test plan

  • All tests pass (768 integration + 414 unit)
  • Lints pass

🤖 Generated with Claude Code

max-sixty and others added 2 commits January 9, 2026 18:38
Previously, `primary_remote()` fell back to returning "origin" when no
remotes existed, which caused confusing downstream errors (e.g., "remote
'origin' not found") and made callers uncertain (hence redundant
`.unwrap_or("origin")` patterns).

Now returns `Err("No remotes configured")` which:
- Makes the error message match the actual problem
- Lets callers handle the no-remote case explicitly
- Removes the need for defensive fallbacks in callers

Updated callers:
- `branch_exists()`: Returns false if no remotes (can't exist on non-existent remote)
- `branches_for_completion()`: Returns empty vec for remote branches
- `project_identifier()`: Falls through to directory-name fallback

Co-Authored-By: Claude <[email protected]>
Resolved conflicts in primary_remote() by adapting to the new global
caching system while maintaining our change to return an error when
no remotes are configured.

Key adaptations:
- Changed cache type from OnceCell<String> to OnceCell<Option<String>>
- Closure returns Some(remote) or None instead of String
- Function converts None to error after cache lookup

Co-Authored-By: Claude <[email protected]>
@max-sixty max-sixty merged commit 79f7701 into main Jan 10, 2026
18 of 19 checks passed
@max-sixty max-sixty deleted the defaults branch January 10, 2026 02:59
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.

2 participants