diff --git a/scripts/check-shell-portability.test.sh b/scripts/check-shell-portability.test.sh index 44143605d9..0a2397d41b 100755 --- a/scripts/check-shell-portability.test.sh +++ b/scripts/check-shell-portability.test.sh @@ -24,6 +24,7 @@ SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SELF_DIR/.." && pwd)" SCRIPT="$SELF_DIR/check-shell-portability.sh" REAL_TOKENS="$REPO_ROOT/scripts/shell-portability-tokens.txt" +. "$SELF_DIR/test-git-helpers.sh" PASS=0 FAIL=0 @@ -1543,9 +1544,7 @@ mkdir -p "$fx/scripts" "$fx/plugins/alpha/skills/demo/context" cp "$SCRIPT" "$fx/scripts/" out="$( cd "$fx" && - git -C "$fx" init -q && - git -C "$fx" config user.email test@example.com && - git -C "$fx" config user.name test && + git_init_test_repo "$fx" && git -C "$fx" commit -q --allow-empty -m base && base="$(git -C "$fx" rev-parse HEAD)" && printf '%s\n' 'stat -c %Y "$f"' >'plugins/alpha/skills/demo/context/mtime.md' && @@ -1639,9 +1638,7 @@ cp "$SCRIPT" "$fx/scripts/" quoted_name="$(printf 'quoted-\303\251.sh')" # trailing U+00E9 byte -- non-ASCII, triggers Git quoting out="$( cd "$fx" && - git -C "$fx" init -q && - git -C "$fx" config user.email test@example.com && - git -C "$fx" config user.name test && + git_init_test_repo "$fx" && git -C "$fx" commit -q --allow-empty -m base && base="$(git -C "$fx" rev-parse HEAD)" && printf '%s\n' 'grep -Eq "\\bfoo\\b" "$file"' >'plain.sh' && diff --git a/scripts/check-skill-portability.test.sh b/scripts/check-skill-portability.test.sh index 9d0ee0bdbb..6684b6bede 100755 --- a/scripts/check-skill-portability.test.sh +++ b/scripts/check-skill-portability.test.sh @@ -16,6 +16,7 @@ SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SELF_DIR/.." && pwd)" SCRIPT="$SELF_DIR/check-skill-portability.sh" REAL_TOKENS="$REPO_ROOT/scripts/skill-portability-tokens.txt" +. "$SELF_DIR/test-git-helpers.sh" # Minimal token list: just the active branch class, so a synthetic case is not # coupled to the shipping list's staged entries. @@ -669,9 +670,7 @@ cp "$SCRIPT" "$fx/scripts/" quoted_name="$(printf 'quoted-\303\251.md')" # trailing U+00E9 byte — non-ASCII, triggers Git quoting out="$( cd "$fx" && - git -C "$fx" init -q && - git -C "$fx" config user.email test@example.com && - git -C "$fx" config user.name test && + git_init_test_repo "$fx" && git -C "$fx" commit -q --allow-empty -m base && base="$(git -C "$fx" rev-parse HEAD)" && mkdir -p 'plugins/p/skills/s' && diff --git a/scripts/fixture-git-isolation-baseline.txt b/scripts/fixture-git-isolation-baseline.txt index e980c8b0c8..e977a9a458 100644 --- a/scripts/fixture-git-isolation-baseline.txt +++ b/scripts/fixture-git-isolation-baseline.txt @@ -61,7 +61,4 @@ plugins/testing/skills/audit/scripts/cant-fail-scan.test.sh plugins/typos-format/hooks/typos-format.test.sh plugins/work-items/skills/work/scripts/preflight.test.sh scripts/check-contract-slice-prune.test.sh -scripts/check-shell-portability.test.sh -scripts/check-skill-portability.test.sh scripts/check-stale-base-overlap.test.sh -scripts/sync-standards-contract.test.sh diff --git a/scripts/sync-standards-contract.test.sh b/scripts/sync-standards-contract.test.sh index 5ca82dd9e3..7e1f14bc3a 100755 --- a/scripts/sync-standards-contract.test.sh +++ b/scripts/sync-standards-contract.test.sh @@ -8,6 +8,7 @@ set -uo pipefail SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT="$SELF_DIR/sync-standards-contract.sh" +. "$SELF_DIR/test-git-helpers.sh" PASS=0 FAIL=0 @@ -76,10 +77,9 @@ base_fixture() { # git_fixture → init repo + commit everything as the base ref; prints base sha git_fixture() { local fixture="$1" - git -C "$fixture" init -q - git -C "$fixture" config core.autocrlf false - git -C "$fixture" config user.email test@example.com - git -C "$fixture" config user.name test + # On refusal (e.g. TMPDIR inside the checkout) stop before add/commit can + # resolve to the enclosing real repository. + git_init_test_repo "$fixture" || return 1 git -C "$fixture" add -A git -C "$fixture" commit -qm base git -C "$fixture" rev-parse HEAD