Fossil SCM
checkin/ad84d53e0a5e7436e5a65740e4cb2192fe6489a46742018f26896eacef4b1f95
Links after fossil purge undo
This corrects 436b00c00b. A purge keeps the links that
other check-ins hold to what it removes, by record number, but
fossil purge undo stored the content under a new number. After an undo,
fossil finfo lacked restored file versions and a check-in could lose its
parent link, with nothing reported until a rebuild.
436b00c00b restores each artifact under its original record number when that number is free. It also kept the purged parent's links during the purge, which was wrong: a freed number can go to an unrelated artifact, which the link would then name as the parent. This check-in deletes those links again during the purge and, after the undo, relinks kept check-ins from their own manifests. A check-in that changed no files, or a merge link to a purged parent, is still not relinked: links may be missing, never false.
Tested with ASan and UBSan on macOS and Linux (x86-64) by a new
test/purge.test, which compares the repository by hash before a purge and
after its undo, including a case where the freed record number is taken by
other content. The test file will come with the test-suite work. Not run on
Windows.