mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-13 03:59:12 +00:00
AGENTS.md asks internal contributors to use litellm_ branches, but the optional pre-push hook only accepted the Conventional Branches form, so following the documented convention meant pushing with --no-verify. The hook now accepts litellm_<description> as well, CONTRIBUTING.md and the installer output describe both forms, and AGENTS.md drops the sentence that banned every slash while keeping the claude/ ban Addresses #44169
42 lines
1.3 KiB
Bash
Executable file
42 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Install the repo's git hooks by pointing core.hooksPath at .githooks.
|
|
#
|
|
# Idempotent: re-running just reaffirms the config and refreshes chmod bits.
|
|
# Run from anywhere inside the repo.
|
|
|
|
set -euo pipefail
|
|
|
|
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
echo "install_git_hooks: not inside a git working tree" >&2
|
|
exit 1
|
|
fi
|
|
|
|
repo_root=$(git rev-parse --show-toplevel)
|
|
hooks_dir="$repo_root/.githooks"
|
|
|
|
if [ ! -d "$hooks_dir" ]; then
|
|
echo "install_git_hooks: $hooks_dir does not exist" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Ensure the hook scripts are executable. New clones on case-preserving
|
|
# filesystems sometimes lose the exec bit; this normalizes it.
|
|
chmod +x "$hooks_dir"/* 2>/dev/null || true
|
|
|
|
git config core.hooksPath .githooks
|
|
|
|
cat <<EOF
|
|
✓ Git hooks installed.
|
|
core.hooksPath = .githooks
|
|
active hooks: $(ls "$hooks_dir" | tr '\n' ' ')
|
|
|
|
These hooks enforce Conventional Commits and the repo's branch naming
|
|
conventions (litellm_<description> or Conventional Branches <type>/<description>).
|
|
Bypass with --no-verify when you need to (e.g. for emergency hotfixes).
|
|
|
|
The CI-equivalent lint is deliberately not installed as an auto-firing hook
|
|
(it can take minutes); run it on demand with 'make check' before committing.
|
|
|
|
To uninstall: git config --unset core.hooksPath
|
|
EOF
|