mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-18 14:08:21 +00:00
* fix: Keep the Pre-Push Hook's Git Environment Away From Its Checks Git exports GIT_DIR to hooks, absolute in a linked worktree, and the hook passed it to the static checks. scripts/imports.test.mts builds scratch repositories with git init, add and commit, so under a push those ran against the pushing worktree: two fixture commits on the branch, its index replaced, and core.bare set in the shared config. The hook now unsets everything git rev-parse --local-env-vars lists before any child runs. The imports suite clears GIT_* for itself as well, because the pre-commit hook reaches it with STATIC_CHECKS_FULL=1. * test: Cover the Hook's Git Environment Scrub in the Pre-Push Scenarios
11 lines
494 B
Bash
Executable file
11 lines
494 B
Bash
Executable file
#!/bin/sh
|
|
[ -n "$CI" ] && exit 0
|
|
|
|
# Git exports GIT_DIR and friends to hooks, and every child inherits them: a
|
|
# check that creates a scratch repository would commit into this one instead.
|
|
unset $(git rev-parse --local-env-vars)
|
|
|
|
# The static checks, slow tier included, against the exact commits being
|
|
# pushed. Refuses a push it cannot verify (a commit other than HEAD, or a
|
|
# worktree with uncommitted changes) instead of checking the wrong content.
|
|
node scripts/pre-push.mts "$@" || exit 1
|