MCPcopy Create free account
hub / github.com/cloudflare/computer / worktreeCode

Function worktreeCode

packages/computer/src/git/status.ts:110–119  ·  view source on GitHub ↗
(head: number, workdir: number, stage: number)

Source from the content-addressed store, hash-verified

108// workdir differs from stage -> 'M'
109// workdir same as stage -> ' '
110function worktreeCode(head: number, workdir: number, stage: number): StatusEntry["worktree"] {
111 if (workdir === 0 && stage === 0 && head === 1) return "D";
112 if (workdir === 0 && stage > 0) return "D";
113 if (head === 0 && stage === 0 && workdir > 0) return "?";
114 // workdirStatus 2 means "differs from HEAD"; stageStatus 3 means
115 // "differs from HEAD but matches workdir" — so workdir == stage,
116 // nothing further to report on Y.
117 if (workdir === 2 && stage !== 3) return "M";
118 return " ";
119}
120
121function errorMessage(cause: unknown): string {
122 if (cause instanceof Error) return cause.message;

Callers 1

statusWithFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected