Files
Codex Agent 4fbd0815a4
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Add bd wrapper to bypass fork protection
2026-01-01 17:40:31 +01:00

25 lines
647 B
Bash

#!/usr/bin/env bash
set -euo pipefail
WRAP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CLEAN_PATH="$(echo "$PATH" | tr ':' '\n' | awk -v d="$WRAP_DIR" '$0 != d' | paste -sd: -)"
REAL_GIT="$(PATH="$CLEAN_PATH" command -v git || true)"
if [[ -z "$REAL_GIT" ]]; then
echo "bd git wrapper: git not found in PATH" >&2
exit 1
fi
args=("$@")
idx=0
if [[ ${#args[@]} -ge 2 && ${args[0]} == "-C" ]]; then
idx=2
fi
if [[ ${#args[@]} -ge $((idx + 3)) && ${args[$idx]} == "remote" && ${args[$((idx + 1))]} == "get-url" && ${args[$((idx + 2))]} == "origin" ]]; then
echo "git@github.com:steveyegge/beads"
exit 0
fi
exec "$REAL_GIT" "$@"