mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
* fix(git): keep a caller's GIT_DIR out of skillshare's git commands Git exports GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE and related variables to hooks that run in a linked worktree. Every git process skillshare started inherited them, and those variables override the directory the command runs in. Run from a post-checkout or post-merge hook, skillshare therefore acted on the hook's repository instead of its own: install's sparse clone turned on sparse checkout there (a later merge removed every file outside the skill's path), the remote tree check's `git init --bare` made it a bare repository, install's reconcile recorded its origin and branch, and push staged and committed into it. internal/gitenv builds git commands without the variables that `git rev-parse --local-env-vars` lists for choosing a repository, work tree, index, object store or config file. GIT_CONFIG_COUNT and GIT_CONFIG_PARAMETERS stay, because users pass credentials through them and install's token auth appends to the existing count. Every git call in cmd/skillshare, internal/install, internal/git, internal/check and internal/config now goes through it, and plugin runCommand starts native CLIs from the same environment because they run git as well. The hooks service keeps its own stricter filter. Closes #852 * test(gitenv): fail on new git commands that bypass gitenv Each git call site converted for #852 is safe only because it goes through gitenv.Command, and about half have no test of their own. A future exec.Command("git", ...) would silently bring the bug back, so a syntactic guard now rejects one outside gitenv, hooks and testutil, mirroring the sourcefs and sourcewalk ratchets. The Environ test also checks a lowercase name, since Windows environment names are case-insensitive, and compares against literal keys so that removing one from repoVars fails it. The wiki records the rule.