job4: SPEC-05 init-identity-precheck-zero-mutation

New T15 block in lib/gitflow-test.sh (+7 assertions, 83→90): fresh git
init sandbox with NO identity (GIT_CONFIG_GLOBAL=/dev/null
GIT_CONFIG_SYSTEM=/dev/null, git 2.53 supports the override) →
gitflow_init must return rc 1 AND leave zero mutation: no develop
branch, unborn HEAD, hooksPath unset, nothing staged, no .gitignore/
.githooks written. Closes J4-06 (WEAK): every test repo up to now set
an identity first, so this precheck never fired.

Mutation (lean scratch copy — only lib/gitflow.sh + lib/gitflow-test.sh
+ templates/gitignore/standard.gitignore, not the whole repo/.git, to
avoid repeating the /tmp exhaustion from the SPEC-01/02/04 full-repo
copies): deleted the identity precheck (gitflow.sh:178-179). RED: 3/7
T15 assertions fail — "nothing staged", "no .gitignore written", "no
.githooks written" — while rc stays 1 and HEAD stays unborn (git itself
still refuses the identity-less commit). This is the half-applied-init
failure mode named in the finding (BLK-012 class): same exit code, but
now via a partial mutation instead of a clean upfront refusal — exactly
why the spec pins zero-mutation checks beyond rc alone.
GREEN: real repo unmutated, 90/90 passed (T15 included).
This commit is contained in:
Bastien Chanot
2026-07-06 19:10:27 +02:00
parent 70d47957c6
commit c8e91e8924
+14
View File
@@ -217,6 +217,20 @@ gitflow_install_hook # write + activate BEFORE any commit (unlike newrepo/hook
echo x > x.txt; git add x.txt echo x > x.txt; git add x.txt
chk "T14c root commit succeeds hook-active-before-first-commit" 'git commit -q -m root 2>/dev/null' chk "T14c root commit succeeds hook-active-before-first-commit" 'git commit -q -m root 2>/dev/null'
echo "T15 — init identity precheck: no identity → rc1, zero mutation"
d="$WORK/noident"; rm -rf "$d"; mkdir -p "$d"; cd "$d" || exit 1
git init -q
echo a > a.txt
init_rc=0
GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null gitflow_init >/dev/null 2>&1 || init_rc=$?
chk "T15 rc 1 (identity unset)" "[ $init_rc -eq 1 ]"
chk "T15 no develop branch" '! git rev-parse --verify -q refs/heads/develop >/dev/null'
chk "T15 unborn HEAD (no commit)" '! git rev-parse --verify -q HEAD >/dev/null 2>&1'
chk "T15 hooksPath unset" '[ -z "$(git config core.hooksPath 2>/dev/null)" ]'
chk "T15 nothing staged" '[ -z "$(git diff --cached --name-only)" ]'
chk "T15 no .gitignore written" '[ ! -e .gitignore ]'
chk "T15 no .githooks written" '[ ! -d .githooks ]'
echo echo
echo "==== RESULT: $PASS passed, $FAIL failed ====" echo "==== RESULT: $PASS passed, $FAIL failed ===="
[ "$FAIL" -eq 0 ] [ "$FAIL" -eq 0 ]