MCPcopy Index your code
hub / github.com/codeaashu/claude-code / trackFileDeletion

Function trackFileDeletion

src/utils/commitAttribution.ts:453–480  ·  view source on GitHub ↗
(
  state: AttributionState,
  filePath: string,
  oldContent: string,
)

Source from the content-addressed store, hash-verified

451 * Used when Claude deletes a file through a non-tracked mechanism.
452 */
453export function trackFileDeletion(
454 state: AttributionState,
455 filePath: string,
456 oldContent: string,
457): AttributionState {
458 const normalizedPath = normalizeFilePath(filePath)
459 const existingState = state.fileStates.get(normalizedPath)
460 const existingContribution = existingState?.claudeContribution ?? 0
461 const deletedChars = oldContent.length
462
463 const newFileState: FileAttributionState = {
464 contentHash: '', // Empty hash for deleted files
465 claudeContribution: existingContribution + deletedChars,
466 mtime: Date.now(),
467 }
468
469 const newFileStates = new Map(state.fileStates)
470 newFileStates.set(normalizedPath, newFileState)
471
472 logForDebugging(
473 `Attribution: Tracked deletion of ${normalizedPath} (${deletedChars} chars removed, total contribution: ${newFileState.claudeContribution})`,
474 )
475
476 return {
477 ...state,
478 fileStates: newFileStates,
479 }
480}
481
482// --
483

Callers

nothing calls this directly

Calls 4

normalizeFilePathFunction · 0.85
logForDebuggingFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected