Commit Graph

2 Commits

Author SHA1 Message Date
Mark Juggurnauth-Thomas
810192fad4 commitcloud: ensure remotebookmarks in local state matches the cloud
Summary:
The `remotebookmarks` field in the local commit cloud state should always be one of:
* The empty set, if the previous sync was performed with remotebookmarks sync disabled; or
* The cloud workspace's remote bookmarks for that version.

Currently when processing remote bookmarks, we may store in the local state the
outcome of conflict resolution for the remote bookmarks.  This is the wrong
thing to do, as it means we won't then upload those conflict resolutions as a
new cloud version, which means they may get lost and rolled back.

Change application of cloud remote bookmarks to store the cloud remote bookmarks
in the local state, even if we changed them through conflict resolution.  This
means we will always upload the newly updated remote bookmarks to the server,
and things will stay more in sync.

Reviewed By: quark-zju

Differential Revision: D27291238

fbshipit-source-id: 8e6a0ab150da5907d32b8127aa0e6ccb17df4eea
2021-03-26 02:15:09 -07:00
Mark Juggurnauth-Thomas
7e5548cda2 commitcloud: add test showing remotebookmark bug on initial sync
Summary:
When connecting to a commit cloud workspace where there are no draft commits to
pull, no local bookmarks to sync, but the remote bookmarks in the local repo
are ahead of the ones in the commit cloud workspace, we fail to sync the remote
bookmarks to the server.

This results in the remote bookmark rewinding on the next sync.

Reviewed By: quark-zju

Differential Revision: D27291237

fbshipit-source-id: 8ba56542492fda26b9cecb6726ddd1b85ed5c180
2021-03-26 02:15:09 -07:00