MCPcopy Index your code
hub / github.com/coder/mux / buildBestEffortDetachBaseRepoHeadCommand

Function buildBestEffortDetachBaseRepoHeadCommand

src/node/runtime/SSHRuntime.ts:217–228  ·  view source on GitHub ↗
(
  baseRepoPathArg: string,
  revisionShell: string
)

Source from the content-addressed store, hash-verified

215}
216
217function buildBestEffortDetachBaseRepoHeadCommand(
218 baseRepoPathArg: string,
219 revisionShell: string
220): string {
221 return [
222 // Resolve only the ref value here, not `<rev>^{commit}`: missing-object
223 // repair still belongs to the following worktree checkout, which produces
224 // richer errors and already has a retry path.
225 `head_oid=$(git -C ${baseRepoPathArg} rev-parse --verify ${revisionShell} 2>/dev/null || true)`,
226 `if [ -n "$head_oid" ]; then git --git-dir=${baseRepoPathArg} update-ref --no-deref HEAD "$head_oid" 2>/dev/null || true; fi`,
227 ].join("\n");
228}
229
230function logSSHBackoffWait(initLogger: InitLogger, waitMs: number): void {
231 const secs = Math.max(1, Math.ceil(waitMs / 1000));

Callers 3

tryWarmWorktreeAddMethod · 0.85
runWorktreeAddMethod · 0.85
forkWorkspaceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected