-
Notifications
You must be signed in to change notification settings - Fork 125
Description
Description
Running npm run plugin:generate causes 22+ files to appear as modified in git status despite having identical content to HEAD. This creates noise in the working tree and can lead to accidental commits of no-op changes.
Steps to Reproduce
- Start with a clean working tree (
git statusshows no changes) - Run
npm run plugin:generate - Run
git status
Expected Behavior
Only files with actual content changes appear in git status.
Actual Behavior
22 files show as modified ( M) including all plugin.json and plugin README.md files. Running git diff on these files produces empty output — the content is byte-for-byte identical to HEAD.
Root Cause
The plugin generator script rewrites output files unconditionally (write-always pattern), even when the content hasn't changed. This updates filesystem timestamps (mtime/ctime), which invalidates git's index stat cache. With core.filemode=false (typical in devcontainers) and * text=auto in .gitattributes, git update-index --refresh fails to resolve the mismatch, leaving the files permanently marked as "needs update."
Affected Files
.github/plugin/marketplace.jsoncollections/hve-core-all.collection.yml- All
plugins/*/README.mdfiles (11 plugins) - All
plugins/*/.github/plugin/plugin.jsonfiles (11 plugins)
Suggested Fix
Update the plugin generator to use a write-if-changed pattern: compute the new content, compare it to the existing file, and only write when the content differs. This avoids touching timestamps on unchanged files.
Workaround
Run git checkout -- <file> on the phantom files to reset the stat cache, or use:
git status --porcelain | grep '^ M' | awk '{print $2}' | xargs git checkout --Environment
- Dev container (Ubuntu 22.04)
core.filemode=false.gitattributes:* text=auto