MCPcopy
hub / github.com/codeaashu/claude-code / getBackupFileNameFirstVersion

Function getBackupFileNameFirstVersion

src/utils/fileHistory.ts:847–862  ·  view source on GitHub ↗

* Gets the first (earliest) backup version for a file, used when rewinding * to a target backup point where the file has not been tracked yet. * * @returns The backup file name for the first version, or null if the file * did not exist in the first version, or undefined if we cannot find a * fi

(
  trackingPath: string,
  state: FileHistoryState,
)

Source from the content-addressed store, hash-verified

845 * first version at all
846 */
847function getBackupFileNameFirstVersion(
848 trackingPath: string,
849 state: FileHistoryState,
850): BackupFileName | undefined {
851 for (const snapshot of state.snapshots) {
852 const backup = snapshot.trackedFileBackups[trackingPath]
853 if (backup !== undefined && backup.version === 1) {
854 // This can be either a file name or null, with null meaning the file
855 // did not exist in the first version.
856 return backup.backupFileName
857 }
858 }
859
860 // The undefined means there was an error resolving the first version.
861 return undefined
862}
863
864/**
865 * Use the relative path as the key to reduce session storage space for tracking.

Callers 3

fileHistoryGetDiffStatsFunction · 0.85
fileHistoryHasAnyChangesFunction · 0.85
applySnapshotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected