Fix worktree order serialization (#14676)

Fixes an issue in the serialization of workspaces that lead to incorrect
ordering of worktrees and refactors some other parts of the code to use
the new method.

Release Notes:

- N/A
75948e536fElliot Thomas committed on 7/18/2024, 7:41:29 AM· committed by GitHubparenteb7fe57
4 files changedLine totals unavailable