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

Function getBackupFileNameFirstVersion

src/utils/fileHistory.ts:849–864  ·  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

847 * first version at all
848 */
849function getBackupFileNameFirstVersion(
850 trackingPath: string,
851 state: FileHistoryState,
852): BackupFileName | undefined {
853 for (const snapshot of state.snapshots) {
854 const backup = snapshot.trackedFileBackups[trackingPath]
855 if (backup !== undefined && backup.version === 1) {
856 // This can be either a file name or null, with null meaning the file
857 // did not exist in the first version.
858 return backup.backupFileName
859 }
860 }
861
862 // The undefined means there was an error resolving the first version.
863 return undefined
864}
865
866/**
867 * 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