Repository navigation
Run nothing at install time - #25
Merged
Merged
Conversation
Install scripts are a common supply-chain attack path, and package managers have started skipping them (pnpm does by default since v10). git-fi's postinstall did two things that don't need to run there. The zsh completion copy (COMPLETE-07) becomes a step the user takes: `install-completions --write` already did the same job into a directory the user names. To keep it discoverable, `git fi -h` and the man page now end with the setup command for each shell (COMPLETE-08), and the quickstart shows it right after `npm install -g`. The install-time git floor (PRE-06) goes too. PRE-02 checks the same floor before every command, and was already the check that governed a run, since --ignore-scripts skipped the postinstall anyway. A new test drives that path with a fake git below the floor. Anyone who installed through the postinstall still has the two zsh files in <npm prefix>/share/zsh/site-functions. npm didn't put them there, so it won't remove them; they keep working but stop tracking new flags until rewritten with `install-completions --write`. STATUS's summary count is corrected to the table's actual row count.
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.
Context
The npm package runs a postinstall that copies the zsh completion files into npm's prefix (
COMPLETE-07) and refuses the install on a git older than 2.41.0 (PRE-06). Install scripts get extra scrutiny as a supply-chain attack path, so this removes it. Completion becomes a command the user runs, shown ingit fi -h, the man page, and the quickstart's install step (COMPLETE-08). The git floor stays enforced before every command byPRE-02.Review guide
Discoverability (what replaces the automatic install)
src/help.ts: one list feeds both-hand the man pagedocs/quickstart.md: the step now sits right afternpm install -gSPEC.mdRemoval
package.jsonscripts/postinstall.mjstest/cli.test.ts: the floor is now tested at run time, where it's enforcedMechanical:
STATUS.md,README.md,docs/troubleshooting.md, comments insrc/git.tsandsrc/build-info.ts, and the regeneratedman/git-fi.1