Skip to content

Conversation

@procr1337
Copy link

@procr1337 procr1337 commented Jun 30, 2025

I am not sure what the previous implementation was trying to do when crates are deleted in the upstream index, but it definitely led to some incorrect behavior.

The actual observed behavior was as follows:

  1. sync_crates_repo fetches upstream, which contains crate deletions (random example commit)
  2. sync_crates_files notices the deletion from the diff and stores the relative path (in this case "ru/st/rust_code_obfuscator") in removed_crates: Vec<PathBuf>
  3. sync_crates_files removes the file in the mirrored repo checkout at
    let _ = fs::remove_file(repo_path.join(rc));
  4. fast_forward calls repo.checkout_head which will somehow add the newly removed file as an addition to the index. Not sure how this happens, I am not very familiar with libgit2
  5. rewrite_config_json ultimately commits the re-added files alongside config.json, which is clearly incorrect since the intention is to only touch config.json.

This here is my attempt at trying to build a deletion logic that actually makes sense to me, where the crates is removed from the crate mirror instead of the index checkout. I am not familiar with panamax feature set so this could have unintended side effects. Also this is mostly untested. Perhaps a safer fix would be to just remove the deletion logic in sync_crates_files altogether

Previous implementation incorrectly deleted paths in the crates.io-index
mirror repo, which in turn led to incorrect update commits for the
config.json file.
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

Successfully merging this pull request may close these issues.

2 participants