mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-04 08:21:50 -04:00
rules: R120 outward-thread hygiene; commit helper keeps such records local
This commit is contained in:
@@ -44,6 +44,10 @@ case "$MSG" in
|
||||
"$TASK:"*|"$TASK "*) FULL="$MSG";;
|
||||
*) FULL="$TASK: $MSG";;
|
||||
esac
|
||||
# R120: outward threads (issue/PR number or URL, or an `Outward: yes` line in a discussion record)
|
||||
# are never named in a commit message and their discussion records are never committed.
|
||||
OUTWARD='(github\.com/[^ ]*/(issues|pull)/[0-9]|\b(issue|PR|pull request) ?#?[0-9]+\b|^Outward: *yes)'
|
||||
printf '%s' "$FULL" | grep -qiE "$OUTWARD" && refuse "message names an outward thread (R120)"
|
||||
|
||||
ROOT="$(find_root)"
|
||||
cd "$ROOT" || refuse "cannot cd to $ROOT"
|
||||
@@ -102,6 +106,14 @@ for f in $(git diff --cached --name-only -- "$PE/current/logs" "$PE/current/task
|
||||
fi
|
||||
done
|
||||
|
||||
# R120: an outward-thread discussion record stays unstaged in the tree (see OUTWARD above).
|
||||
for f in $(git diff --cached --name-only --diff-filter=AM -- "$PE/current/discussions"); do
|
||||
if [ -f "$f" ] && grep -qiE "$OUTWARD" -- "$f"; then
|
||||
git reset -q -- "$f" || refuse "git reset $f failed"
|
||||
echo "left out: $f (outward-thread discussion record; R120 keeps it local)"
|
||||
fi
|
||||
done
|
||||
|
||||
if git diff --cached --quiet; then
|
||||
refuse "nothing staged for $TASK"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user