Sync deletions, but only of files which came from the source. - #5
Merged
Merged
Conversation
Deletions were never propagated, as the sync workflow checked out the source with a depth of 1, so `git log --diff-filter=D` could never see a deletion. Had it done so, it would also have deleted any file in the target that merely shared a name with one deleted from the source. Both repositories are now checked out with full history, and a file is only deleted from the target if: - It originated from the source: when it was last added to the target, it matched a version which the source once had. - It hasn't been re-added since: it was last added to the target before it was deleted from the source. - It hasn't been modified downstream: it currently matches a version which the source once had. Timestamps come from first-parent history, so they reflect when a change landed on each branch rather than when it was first committed. Renames are treated as a deletion plus an addition. This is enabled by default, and can be disabled with `syncDeletions`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Sync deletions, but only of files which came from the source.
Files deleted from a source were never deleted downstream (e.g.
claude-code-review.yml, which had to be removed from this repo by hand in b042a53).Why it never worked
The sync workflow checks out the source with
actions/checkout's defaultfetch-depth: 1. In a single-commit shallow clone,git log --diff-filter=Dsees nothing, so the deletion step always found zero files. Had it found any, it would have deleted any target file with a matching name, whether or not it came from the source.What's changed
Kept: F (re-added after being deleted from the source).--first-parenthistory, so they reflect when a change landed on each branch rather than when it was committed on a feature branch.--no-renames). Previously a rename showed up asRand was missed even with full history.syncDeletionsoption, on by default. Per-child or global, and an explicitfalseis respected (plain//=would have overwritten it).Testing
Scenarios: 46 checks across 21 synthetic source/target histories, including: plain deletion, an unrelated same-name file, identical and different re-adds, downstream modification, a target-original file overwritten by sync, a graph restructured through a new intermediate repo, ignored files,
source.root/target.rootmapping, renames, deletion via merge commit, sync via merge commit, delete/re-add cycles, stale versions, glob and unicode filenames, a directory at the path, and a shallow clone. The previous script fails 20 of them; dropping--first-parentfails 2.Real graph (dry run, nothing pushed): replayed every edge reachable from
github-configagainst currentmains:github-config→github-graph@ #4claude-code-review.yml(matches b042a53)scala-library-config→ 7 libraries, template, 3× Themislinter.yml(deleted upstream in scala-config#38)scala-website-config→ template, fairmap, Themis, Kairoslinter.ymland the now-unreferenceddeploy/CaddyfileThemis→IrisModelTier.scala(moved out in Themis#138)parse-config.shwasn't executed locally (nojqavailable); the change there is a singleif . == nulldefault.Note
Merging enables this for every caller of
sync.yml@main. The next sync from each source above will open or refresh PRs containing the deletions listed.🤖 Generated with Claude Code