fix: rename type declaration so the repo can be cloned on Windows - #569
Closed
eeshsaxena wants to merge 1 commit into
Closed
fix: rename type declaration so the repo can be cloned on Windows#569eeshsaxena wants to merge 1 commit into
eeshsaxena wants to merge 1 commit into
Conversation
frontend/src/types/virtual:git-version.d.ts contains a colon, which is not a
legal filename character on NTFS. Cloning on Windows fails outright:
error: invalid path 'frontend/src/types/virtual:git-version.d.ts'
fatal: unable to checkout working tree
git cannot even write that index entry, so sparse-checkout and git reset fail
as well - a Windows contributor cannot check the repository out at all.
The colon in the filename is only a convention mirroring the virtual module
id; it has no meaning to the compiler. Resolution comes from the
declare module 'virtual:git-version' inside the file, and tsconfig.json picks
it up via "include": ["src"], so the file name is irrelevant. Nothing refers
to the path either - footer.tsx imports the module id and vite.config.js
defines it - so the rename is behaviour-preserving. The file contents are
unchanged (same blob).
Member
|
hey, |
Author
|
No LLMs were used in the creation of this PR. I ran into the bug manually when trying to clone the repo on Windows, and I pushed the fix myself via the GitHub API since local git mv operations were blocked , Used an AI tool to help format the PR description for clarity |
Member
|
Closing this since it violates our AI policy. |
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.
Problem
frontend/src/types/virtual:git-version.d.tscontains a colon. That is not a legal filename character on NTFS (it's the alternate-data-stream separator), so the repository cannot be cloned on Windows at all:It isn't just the checkout: git can't write that index entry either, so the usual escape hatches don't help -
git sparse-checkout set backend workerfollowed bygit reset --hardstill fails with the same error, and so doesgit checkout HEAD -- .. In practice a Windows contributor can clone the bare objects and nothing else.Fix
Rename the file to
frontend/src/types/git-version.d.ts. Contents are unchanged (same blob), so this is a pure rename.That's safe because the filename carries no meaning here:
declare module 'virtual:git-version'inside the file, not what the file is called. The name was just mirroring the virtual module id.frontend/tsconfig.jsonuses"include": ["src"], so the declaration is picked up by directory glob regardless of filename.frontend/src/components/footer.tsxdoesimport version, { Commit } from 'virtual:git-version'(the module id) andfrontend/vite.config.jsdeclaresconst virtualModuleId = 'virtual:git-version'- both are the module id, which this PR does not touch.After this change no tracked path in the repo contains a colon, so a plain
git cloneworks on Windows.A note on how this was made
Slightly unusual: because the offending path can't be written to the index on Windows, I couldn't
git mvit locally. The commit was created through the GitHub git-data API (new tree frommainwith the blob re-pointed and the old path removed), which is why it lands as a single clean rename. GitHub's own compare view confirms it:renamed ... (+0/-0), 1 commit.I don't have a Windows-free environment to run the frontend build in, so I haven't executed
pnpm buildagainst the rename - though since the blob is byte-identical and resolution is by module id +include: ["src"], there's nothing for it to change. Happy to adjust the filename if you'd prefer a different convention (e.g.virtual-git-version.d.tsto keep the association visible).