* 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, )
| 845 | * first version at all |
| 846 | */ |
| 847 | function 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. |
no outgoing calls
no test coverage detected