MCPcopy Create free account
hub / github.com/modem-dev/hunk / fileStatusLabel

Function fileStatusLabel

src/ui/staticDiffPager.ts:252–276  ·  view source on GitHub ↗

Describe the file-level change without exposing raw patch transport headers.

(file: DiffFile)

Source from the content-addressed store, hash-verified

250
251/** Describe the file-level change without exposing raw patch transport headers. */
252function fileStatusLabel(file: DiffFile) {
253 if (file.isTooLarge) {
254 return "skipped large file";
255 }
256
257 if (file.isBinary) {
258 return "binary";
259 }
260
261 switch (file.metadata.type) {
262 case "new":
263 return file.isUntracked ? "untracked" : "new file";
264 case "deleted":
265 return "deleted";
266 case "rename-pure":
267 return "renamed";
268 case "rename-changed":
269 return "renamed modified";
270 case "change":
271 default:
272 return file.metadata.prevMode && file.metadata.prevMode !== file.metadata.mode
273 ? "mode changed"
274 : "modified";
275 }
276}
277
278/** Use an arrow label for renamed files so static output keeps important path metadata. */
279function fileDisplayPath(file: DiffFile) {

Callers 1

renderStaticFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected