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

Function indexCode

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

Source from the content-addressed store, hash-verified

93// HEAD present, stage != HEAD -> M (stage is "version 2")
94// otherwise -> ' '
95function indexCode(head: number, stage: number): StatusEntry["index"] {
96 if (head === 0 && stage > 0) return "A";
97 if (head === 1 && stage === 0) return "D";
98 // stage === 2 means "differs from HEAD" (anywhere, regardless of workdir);
99 // stage === 3 means "differs from HEAD but matches workdir" — still a
100 // staged modification against HEAD.
101 if (head === 1 && (stage === 2 || stage === 3)) return "M";
102 return " ";
103}
104
105// Derive the Y (workdir-vs-index) column.
106// workdir absent, anything -> 'D' (deleted in workdir)

Callers 1

statusWithFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected