Fix sync -H syncing the .cld-sync meta file - #131
Merged
Merged
Conversation
With `--include-hidden`, `walk_dir` returned the `.cld-sync` meta file as a regular local file, so: - `sync --push -H` uploaded it as a raw asset, before it was updated, and found it out of sync on every later push; - `sync --pull -H` deleted the local meta file as unique, or overwrote it with a copy pushed earlier. Add `exclude_file` to `file_utils` and drop `.cld-sync` files, at any depth, from the local and remote file lists in `SyncDir`. A copy already pushed by an earlier version is left on Cloudinary. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`delete_cld_folder_if_exists` called `delete_resources_by_prefix` with the default `image` resource type, so raw files pushed by a test in fixed folder mode were left behind and `delete_folder` failed with "Folder is not empty" for every following test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The Search API indexes new assets with a delay, so counting remote assets right after the push was flaky. `Synced | 2` already shows that the meta file was not uploaded. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
synckeeps a.cld-syncmeta file in the local folder. With-H/--include-hiddenit was treated as a regular file.Use cases fixed
sync --push -H.cld-syncuploaded as a public raw asset, before it is updated, then out of sync on every later pushsync --pull -H --force, no.cld-syncon Cloudinary.cld-syncdeleted as a unique local filesync --pull -H,.cld-syncpushed earlier.cld-syncoverwritten with the remote copy.cld-syncof a subfolder synced separately (sub/.cld-sync)Brief Summary of Changes
exclude_file(files, file_name)(cloudinary_cli/utils/file_utils.py): drops entries whose base name isfile_name.SyncDir.__init__(cloudinary_cli/modules/sync.py): applies it with.cld-syncto the local and remote file lists.TestCLISyncand 4 offline tests inTestCLISyncMetaFileOffline.What does this PR address?
Are tests included?
Reviewer, please note:
.cld-syncasset already pushed by an earlier version stays on Cloudinary:syncneither deletes nor downloads it.Checklist:
Tests not run yet.
🤖 Generated with Claude Code