Repository navigation
Process hard links to one file once - #275
Merged
Merged
Conversation
collect deduplicated files by canonical path, which can't see hard links, so two names for one file went to two workers at once and one could fail with "file changed while formatting". On unix, deduplicate by (dev, ino), keeping the first name in walk order; the canonical path stays the key when metadata fails and on Windows, where std's file index is unstable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GwxvdT99Lm5gtULaszKTmo
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.
Fixes #272
collectdeduplicated the walk by canonical path, and canonicalizing doesn't resolve hard links to one name. So two links to one file went to two workers at once, and one could fail with "file changed while formatting".On unix the dedup key is now (dev, ino) from the file's metadata, keeping the first name in walk order. The second name is dropped silently, the same as a file named twice on the command line today. The canonical path is still the key when metadata fails, and on Windows, where std's file index is behind the unstable
windows_by_handle, so Windows behavior is unchanged.Tests (unix only): two hard links in one directory, for write mode (5 runs),
--checkand--lint. On main all three fail on every run of 10, with write mode giving three different results across those runs (exit 0 with "reformatted 1 of 2 files", or exit 2 with "a.groovy: file changed while formatting", or the same for b.groovy). On this branch they passed 10 of 10.Release builds of main and this branch give byte-identical stdout, stderr and exit codes for
--check --diffand--lintover the gate corpus, which has no hard links.🤖 Generated with Claude Code
https://claude.ai/code/session_01GwxvdT99Lm5gtULaszKTmo