olcli icon indicating copy to clipboard operation
olcli copied to clipboard

[Bug] sync feature doesn't work when deleting files.

Open bicheTortue opened this issue 8 months ago • 5 comments

What happened?

When a file is deleted locally, it is then pulled during the first part of the sync command. When trying to push the changes, the file exists again.

Expected behavior:

The file should be deleted on the remote.

Steps to reproduce:

  1. Delete file locally
  2. Run olcli sync

Environment:

  • OS: Archlinux
  • Version: Linux 6.19.9-arch1-1

bicheTortue avatar Mar 24 '26 14:03 bicheTortue

Maybe a .gitignore-like config file is required @aloth

Poseidon-fan avatar Apr 13 '26 10:04 Poseidon-fan

Thanks for the clear report and reproduction steps, @bicheTortue.

What you're seeing makes sense with the current sync behavior: right now sync effectively treats the remote as the source of truth during the pull phase, so a file deleted locally gets restored before the push step has a chance to propagate that deletion.

So this is amissing sync capability, not expected behavior.

@Poseidon-fan, a .gitignore-style config could be useful for intentionally excluded files, but it would not solve this specific case. The actual issue here is that deletions are not being tracked and reconciled properly during sync.

I'll look into fixing this so local deletions can be propagated to the remote instead of being resurrected on pull - however not yet sure how.

In the meantime, the safest workaround is:

  • delete the file locally
  • delete it on the remote as well
  • then run sync again

Thanks for reporting it.

aloth avatar Apr 14 '26 14:04 aloth

Hello, thanks for your reply @aloth.

I have been thinking of ways to improve on the current way the program works. I'd be very interrested to get in on the developpement process. Tell me if you are interrested.

bicheTortue avatar Apr 14 '26 14:04 bicheTortue

Thanks, @bicheTortue - I’d definitely be interested.

Feel free to drop me a line: [email protected]

aloth avatar Apr 14 '26 16:04 aloth

Fixed in v0.2.0 - thanks again for the clear repro, @bicheTortue.

What changed:

• sync now records a manifest of remote files in .olcli.json on every pull, then uses it on the next sync to detect "this file existed before, gone now → propagate the deletion to Overleaf." Your repro now does the right thing on the very next sync. • Added sync --no-delete as a safety opt-out, and sync --dry-run --verbose reports planned deletions so you can preview before applying. • While we were in there: re-enabled the delete / rm and rename / mv commands that had been disabled (the entity-id concern in the old comment was already solved by findEntityByPath).

⚠️ Behavior heads-up for anyone reading this later: sync is now destructive in both directions. If you have a stale local checkout where you intentionally deleted some files, the next olcli sync will remove them from Overleaf too. Use --no-delete once or pull a fresh copy if that surprises you. Full release notes: https://github.com/aloth/olcli/releases/tag/v0.2.0

Closing - please reopen if anything still misbehaves on your end!

aloth avatar Apr 27 '26 08:04 aloth