fix(10.2): exclude planning artifacts from import gate
- Align Git-backed source enumeration with the fallback scan - Prove tracked historical imports are ignored in self-test
This commit is contained in:
@@ -30,7 +30,7 @@ refuse() {
|
||||
tracked_source_files() {
|
||||
local repo="$1"
|
||||
if git -C "$repo" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
git -C "$repo" ls-files -z -- '*.go' '*.tmpl' '*.sh'
|
||||
git -C "$repo" ls-files -z -- '*.go' '*.tmpl' '*.sh' ':(exclude).planning/**'
|
||||
return
|
||||
fi
|
||||
(
|
||||
@@ -52,6 +52,7 @@ check_layout() {
|
||||
check_imports_in() {
|
||||
local repo="$1" file name
|
||||
while IFS= read -r -d '' file; do
|
||||
[[ "$file" != .planning/* ]] || continue
|
||||
[[ "$file" != 'scripts/check-phase10.2.sh' ]] || continue
|
||||
for name in "${NAMES[@]}"; do
|
||||
if grep -Fq "${IMPORT_PREFIX}${name}" "$repo/$file"; then
|
||||
@@ -125,6 +126,11 @@ run_self_test() {
|
||||
cp "$ROOT/modules/$name/README.md" "$scratch/modules/$name/README.md"
|
||||
done
|
||||
|
||||
check_hygiene "$scratch" "$app"
|
||||
mkdir -p "$scratch/.planning"
|
||||
printf '%s%s\n' "$IMPORT_PREFIX" backpack >"$scratch/.planning/historical.go"
|
||||
git -C "$scratch" init -q
|
||||
git -C "$scratch" add README.md modules .planning/historical.go
|
||||
check_hygiene "$scratch" "$app"
|
||||
|
||||
mkdir "$scratch/backpack"
|
||||
@@ -132,8 +138,9 @@ run_self_test() {
|
||||
rmdir "$scratch/backpack"
|
||||
|
||||
printf '%s%s\n' "$IMPORT_PREFIX" backpack >"$scratch/old_import.go"
|
||||
git -C "$scratch" add old_import.go
|
||||
expect_refusal 'old import' 'old import' "$scratch" "$app"
|
||||
rm "$scratch/old_import.go"
|
||||
git -C "$scratch" rm -q -f old_import.go
|
||||
|
||||
mv "$scratch/modules/backpack/README.md" "$scratch/modules/backpack/README.saved"
|
||||
expect_refusal 'missing README' 'missing README' "$scratch" "$app"
|
||||
|
||||
Reference in New Issue
Block a user