Files
anxinyan/scripts/git-hooks/post-checkout
2026-06-04 16:12:59 +08:00

19 lines
416 B
Bash
Executable File

#!/bin/sh
# Third argument is 1 for branch checkout and 0 for file checkout.
[ "${3:-0}" = "1" ] || exit 0
repo_root=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
git_dir=$(git rev-parse --git-dir 2>/dev/null) || exit 0
case "$git_dir" in
/*) ;;
*) git_dir="$repo_root/$git_dir" ;;
esac
(
cd "$repo_root" || exit 0
./scripts/gitnexus-refresh.sh
) >>"$git_dir/gitnexus-refresh.log" 2>&1 &
exit 0