mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
fix(github): fail closed when the SSH git provider is gone
getCurrentHeadOid and probeTrackedUpstreamBranches only routed through the SSH provider when one was registered. With connectionId set but the provider unregistered (dropped connection, not yet reattached) they fell through to client-side git with cwd pointing at the remote repoPath — on a machine with a same-named local path that silently answers for the wrong repository. getCurrentHeadOid feeds shouldHideMergedImplicitPR, so a wrong OID changes which PR the UI attributes to a worktree. Both now take their existing unknown path (null / probeFailed) instead, matching repo-default-branch.ts. Local and WSL routing is unchanged.
This commit is contained in:
@@ -2315,8 +2315,12 @@ async function getCurrentHeadOid(
|
||||
connectionId?: string | null,
|
||||
localGitOptions: { wslDistro?: string } = {}
|
||||
): Promise<string | null> {
|
||||
const provider = connectionId ? getSshGitProvider(connectionId) : null
|
||||
if (connectionId && !provider) {
|
||||
// Why: repoPath is remote — a dropped SSH provider must answer "unknown", never run client git against a same-named local path.
|
||||
return null
|
||||
}
|
||||
try {
|
||||
const provider = connectionId ? getSshGitProvider(connectionId) : null
|
||||
const result = provider
|
||||
? await provider.exec(['rev-parse', 'HEAD'], repoPath)
|
||||
: await gitExecFileAsync(['rev-parse', 'HEAD'], {
|
||||
@@ -2814,8 +2818,12 @@ async function probeTrackedUpstreamBranches(
|
||||
upstreamsByBranchName: Map<string, TrackedUpstreamBranch | null>
|
||||
}> {
|
||||
const args = ['for-each-ref', '--format=%(refname)%00%(upstream)', 'refs/heads']
|
||||
const provider = connectionId ? getSshGitProvider(connectionId) : null
|
||||
if (connectionId && !provider) {
|
||||
// Why: repoPath is remote — a dropped SSH provider must fail the probe, never enumerate a same-named local repo's refs.
|
||||
return { probeFailed: true, upstreamsByBranchName: new Map() }
|
||||
}
|
||||
try {
|
||||
const provider = connectionId ? getSshGitProvider(connectionId) : null
|
||||
const result = provider
|
||||
? await provider.exec(args, repoPath)
|
||||
: await gitExecFileAsync(args, {
|
||||
|
||||
Reference in New Issue
Block a user