forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-push-singleflight
More file actions
executable file
·27 lines (22 loc) · 1.04 KB
/
Copy pathpre-push-singleflight
File metadata and controls
executable file
·27 lines (22 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
set -euo pipefail
# Git runs hooks with the working directory at the top of the invoking work
# tree, so fall back to it when `git rev-parse --show-toplevel` cannot resolve a
# work tree. In a linked worktree whose git context resolves to a git dir,
# show-toplevel exits 128 and this script would otherwise abort the gate.
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
cd "$ROOT"
# shellcheck source=dev-harness/_resolve_python.sh
source scripts/dev-harness/_resolve_python.sh
PYTHON_BIN="$(dev_harness_python)"
export PYTHON="$PYTHON_BIN"
PREFLIGHT_COMMAND=(scripts/pre-push "$@")
if dev_harness_python_uses_windows_paths "$PYTHON_BIN"; then
if ! command -v cygpath >/dev/null 2>&1; then
echo "FAIL: native Windows Python requires Git for Windows Bash (cygpath was not found)." >&2
exit 1
fi
GIT_BASH_NATIVE="$(cygpath -w "$(command -v bash)")"
PREFLIGHT_COMMAND=("$GIT_BASH_NATIVE" scripts/pre-push "$@")
fi
exec "$PYTHON_BIN" .github/scripts/preflight_runner.py --name pre-push -- "${PREFLIGHT_COMMAND[@]}"