From c8e91e8924333677fd8ba404859f3040a4f554df Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Mon, 6 Jul 2026 19:10:27 +0200 Subject: [PATCH] job4: SPEC-05 init-identity-precheck-zero-mutation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- lib/gitflow-test.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/gitflow-test.sh b/lib/gitflow-test.sh index 87b0645..21a2cde 100644 --- a/lib/gitflow-test.sh +++ b/lib/gitflow-test.sh @@ -217,6 +217,20 @@ gitflow_install_hook # write + activate BEFORE any commit (unlike newrepo/hook 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' +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 "==== RESULT: $PASS passed, $FAIL failed ====" [ "$FAIL" -eq 0 ]