Repository navigation
fix(path-spelling): name a misspelled symlink by the link, not its target - #1340
Merged
Merged
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
…rget With docs/assets -> ../.github/assets, writing docs/Assets/badge.svg hinted .github/assets/badge.svg: the hint kept the written directories only up to the misspelling and took the canonical rest, which crossed the link. Each remaining component now takes its stored name: canonicalize's for a plain entry, and for a link the only link in its directory resolving to the same place, so the link sitting next to its target keeps its own name. Two links in one directory to the same place fall back to the canonical path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumike
force-pushed
the
fix/spelling-hint-names-link
branch
from
October 29, 2026 06:19
33827ef to
801eb86
Compare
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.
Summary
Follow-up from the #1326 review. With
docs/assets -> ../.github/assets, a page writingdocs/Assets/badge.svggot the hint.github/assets/badge.svg, which names the link's target instead of the link.hintkept the written directories only up to the misspelled component and then took the canonical rest, which crosses the symlink.Now
hintwalks the remaining components one at a time. Each one becomes the entry of its parent's listing thatdir.join(written)opens:canonicalizegives it (the premise the crate already relies on)LinkDirmaps tolinkdirand not to its targetrealin the same directoryCase is never folded. The scan runs only on the error path.
When two links in one directory lead to the same place, the target can't tell them apart. The hint then falls back to the canonical path rather than guess. The existing fallbacks don't change: a
..in the written prefix or the rest, and a component that does not resolve.There are no new dependencies. Matching links by canonical path is enough here, so
same-fileisn't needed. It would not help anyway: it follows the final symlink.Changed expectations:
LinkDir/a.md→linkdir/a.md(wasreal/a.md),Link.md→link.md(wasreal/a.md)hintfromlinkdirforinlink/b.md→linkdir/inlink/b.md(waslinkdir/foo/b.md): links past the misspelling keep their names tooread_file_spells_a_symlinked_folder_by_the_link:docs/assets/badge.svg(was.github/assets/badge.svg)No CHANGELOG entry: the wrong-case hint hasn't been released yet.
Validation
a_misspelled_link_out_of_its_folder_keeps_the_links_name(case-insensitive FS only) covers the misspelled link, a misspelled name after the link, and the two-links fallback.hints_keep_the_written_directoriescallshintdirectly through two links, so it also runs on Linux.make test,make lint,make formatare clean.🤖 Generated with Claude Code