forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-push
More file actions
executable file
·18 lines (17 loc) · 811 Bytes
/
Copy pathpre-push
File metadata and controls
executable file
·18 lines (17 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/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 show-toplevel cannot resolve a work tree (linked
# worktree git-dir contexts exit 128 here and otherwise abort the hook, forcing
# a --no-verify push that silently bypasses the local gate).
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
HOOK_NAME="$(basename "$0")"
if [ "$HOOK_NAME" = "pre-push" ]; then
if [ -x "$ROOT/scripts/pre-push-singleflight" ]; then
exec "$ROOT/scripts/pre-push-singleflight" "$@"
fi
# Older worktree branches may predate the single-flight wrapper even though
# linked worktrees share this dispatcher. Keep their checked-in hook usable.
exec "$ROOT/scripts/pre-push" "$@"
fi
exec "$ROOT/scripts/$HOOK_NAME" "$@"