Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does bitpocket distinguish between delete/create? #86

Open
guettli opened this issue Sep 3, 2019 · 1 comment
Open

How does bitpocket distinguish between delete/create? #86

guettli opened this issue Sep 3, 2019 · 1 comment

Comments

@guettli
Copy link

guettli commented Sep 3, 2019

How does bitpocket distinguish between delete/create?

AFAIK for this to work you need a list of all files of the last sync.

It would be nice if you could explain your solution in the README.

@greezybacon
Copy link
Collaborator

Hey- good idea. That's probably something worth explaining.

Bitpocket uses rsync to create both a local file listing and a remote file listing on each run. If this is the first time that Bitpocket has been used, it assumes that the local filesystem is the reference and will protect all local files. It will push all local files to the remote, replacing them, and pull all files from the remote which are not on the local.

For all future runs, Bitpocket will make three comparisons: (1) first, the snapshot of the previous sync to the current filesystem snapshot to arrive at the deleted files (those that were there after the previous sync which are no longer there), (2) the files which have shown up or been modified locally since the last sync, and (3) the files which have been deleted on the remote since the last sync. From these three lists, Bitpocket protects files in the push and pull phases. In the pull phase, it protects locally-created, -modified, and -deleted files. This way local changes are not undone. In the push phase, it protect remotely-deleted files. This way deleted files don't reappear on the remote. Since the pull runs first, all other changes from the remote are synced and there's no need to protect other types of changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants