Skip to content

feat(git): support non-origin remotes#19

Merged
epodivilov merged 2 commits into
mainfrom
refactor/non-origin-remotes
Jun 19, 2026
Merged

feat(git): support non-origin remotes#19
epodivilov merged 2 commits into
mainfrom
refactor/non-origin-remotes

Conversation

@epodivilov

Copy link
Copy Markdown
Owner

Summary

  • Removes hardcoded "origin/..." from bun-git-adapter.ts (listRemoteBranches, getDefaultBranch, mergeFFOnly, updateBranchRef, and deleteRemoteBranch)
  • The adapter now resolves the remote name once per instance by walking a priority chain: branch.<HEAD>.remote -> branch.main.remote -> branch.master.remote -> sole-remote auto-detect -> "origin"
  • Port signatures unchanged - resolution is entirely internal to the adapter (callers that already pass an explicit remote still win)
  • Enables multi-remote and fork workflows where the user's --upstream is not literally origin
  • createRemoteFixture gains an optional remoteName to drive the new tests (existing callers unaffected)

Closes Vikunja #36.

Test plan

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (472 tests, 7 new)
  • New tests: non-origin remote name (upstream), multi-remote disambiguation via branch.main.remote, no-remote-configured error
  • Existing origin-based tests unchanged

…olution

- createWorktreeFromRemote resolves the remote internally (param now optional),
  so 'wt create <remote-branch>' works on non-origin remotes instead of
  failing against a hardcoded origin/<branch>
- prefer main/master tracking remote over HEAD's when resolving the primary
  remote: HEAD may track a side remote (fork), the wrong answer for the
  repo-level queries these methods perform
- treat git's '.' tracking sentinel (local-branch tracking) as 'no remote'
  so resolution falls through instead of poisoning the cache
- rename resolved -> remoteName, dedupe the refs/remotes/<remote>/ prefix
- test: create-from-remote via a resolved non-origin remote
@epodivilov epodivilov merged commit 228b21b into main Jun 19, 2026
1 check passed
@epodivilov epodivilov deleted the refactor/non-origin-remotes branch June 19, 2026 22:58
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.

1 participant