Archive keeps a detached HEAD's commit before removing the folder. When the
removal failed, the folder stayed, and Undo, Restore or reopening the
directory unarchived the workspace without deleting the ref. A later archive
with the folder gone kept the old ref, and a restore came back at that
stale commit instead of the workspace's branch.
The ref is now deleted in ensureWorkspaceRecordUnarchived, which every
unarchive passes through, so a kept commit exists only while its workspace
is archived. A repository root that is gone or no longer a git repository
has no ref to delete and does not block the unarchive.