Archive saved a commit only for a detached HEAD, keyed by workspace ID.
That split Paseo into HEAD kinds, keyed the ref to something two
workspaces can share, and restore still came back on a new restored/<id>
branch instead of the detached HEAD the worktree had.
Archive now saves the HEAD of every worktree folder it removes as
refs/paseo/archived/<sha256 of the folder path>/<git's name for HEAD>,
the name being `git rev-parse --abbrev-ref HEAD`. Restore checks out
that name when it still resolves to the saved commit, and the commit
otherwise. Git decides whether that puts HEAD on a branch or detaches
it; restore never creates, moves, or deletes a branch. The restore
screen no longer names a branch when a saved HEAD exists.
The saved HEAD is deleted on every unarchive. A failed delete is logged
and does not block the unarchive; the next archive of an active
workspace whose folder is already gone drops the leftover ref, so it is
never read as current.
ragokan found the lost detached commits in #9850.
Closes#9856
Co-authored-by: Okan YILDIRIM <63511519+ragokan@users.noreply.github.com>