fix(queue): genesis owner-not-reviewer check, assign wording, queue-commit HEAD-moved message, calendar dates (row 33, #1508)
Built by filbert, approved by darkwing in round 1 (#1508 comment 26651). Manifest fe7da3ef, 10 paths. Suites green on an index export. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+16
-3
@@ -74,6 +74,15 @@ HOOK="$ROOT/.git/hooks/pre-commit"
|
||||
|
||||
TMPD=$(mktemp -d "${TMPDIR:-/tmp}/queue-commit.XXXXXX") || die 1 "mktemp failed"
|
||||
|
||||
# The canary's index holds $1's tree, and the hook diffs it with the live
|
||||
# HEAD. Once another commit lands, the clean run can fail with the guard
|
||||
# working as installed, so a moved HEAD is reported as that, not as the guard.
|
||||
head_moved() {
|
||||
local now
|
||||
now=$(g rev-parse --verify -q HEAD) || die 2 "refused ($2): HEAD has no commit"
|
||||
[ "$now" = "$1" ] || die 2 "refused ($2): HEAD moved since $1 was recorded (another commit landed); run queue-commit.sh again"
|
||||
}
|
||||
|
||||
# --- the queue guard, active and not just present (8.12, G2). $1 is the
|
||||
# commit whose hook blob and tree the checks use. ---
|
||||
guard_check() {
|
||||
@@ -88,11 +97,15 @@ guard_check() {
|
||||
|| die 2 "refused ($when): .git/hooks/pre-commit differs from $HOOK_REL at $h"
|
||||
out=$(g config --show-scope --get-all core.hooksPath 2>/dev/null)
|
||||
[ -z "$out" ] || die 2 "refused ($when): core.hooksPath is set ($(printf '%s' "$out" | tr '\n\t' '; ')), so git would not run the queue guard"
|
||||
# The canary: git itself runs the hook it would run for a commit.
|
||||
# The canary: git itself runs the hook it would run for a commit. HEAD is
|
||||
# checked before it and again if the clean run fails, since a commit can
|
||||
# land between the two.
|
||||
head_moved "$h" "$when"
|
||||
idx="$TMPD/canary-$when/index"
|
||||
mkdir -p "$(dirname "$idx")"
|
||||
GIT_INDEX_FILE=$idx g read-tree "$h" || die 1 "canary ($when): read-tree failed"
|
||||
if ! out=$(cd "$ROOT" && GIT_INDEX_FILE=$idx git hook run pre-commit 2>&1); then
|
||||
head_moved "$h" "$when"
|
||||
die 2 "refused ($when): the canary's clean run failed, so git is not running the queue guard as installed: $out"
|
||||
fi
|
||||
GIT_INDEX_FILE=$idx g update-index --add --cacheinfo "100644,$(g rev-parse "$h:$HOOK_REL"),$QMD" \
|
||||
@@ -133,8 +146,8 @@ if [ "$MODE" = install ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# --- 1. guard. H is recorded first, before the canary, so a branch that moves
|
||||
# at any later point makes update-ref in step 7 fail. ---
|
||||
# --- 1. guard. H is recorded first, before the canary. A branch that moves
|
||||
# later is refused by a guard check or, after step 7's, by update-ref. ---
|
||||
H=$(g rev-parse --verify -q HEAD) || die 2 "refused: HEAD has no commit"
|
||||
BRANCH=$(g symbolic-ref -q --short HEAD) || die 2 "refused: HEAD is detached"
|
||||
guard_check "$H" step1
|
||||
|
||||
Reference in New Issue
Block a user