Skip to content

Commit 1cb7ced

Browse files
committed
scrub: some left over fixes
These fixes were in intermediate merge commits intended to be squashed into the PR that would have been merged after as it was rebased, and some things that slipped through the cracks. Remove conflict_skip map and per-commit skip check in check_one_commit, commits are filtered ahead of time. Move flake_ordered/quick_ordered construction before the conflict check. Remove some straggler /dev/null redirects
1 parent 7517ee2 commit 1cb7ced

1 file changed

Lines changed: 16 additions & 25 deletions

File tree

contrib/scrub-commit-history.sh

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ if [ "$quick" = only ] && [ "$all_checks" = true ]; then
168168
fi
169169

170170
repo_root=$(git rev-parse --show-toplevel)
171-
172171
system=$(nix eval --offline --raw --impure --expr builtins.currentSystem)
173172

174173
# Resolve VCS mode
@@ -347,10 +346,6 @@ expect_fail_matches_checks() {
347346
# Appends to build_failed[] on failure.
348347
check_one_commit() {
349348
local hash=$1
350-
if [ -n "${conflict_skip[$hash]:-}" ]; then
351-
echo " - $(fmt_commit "$hash") (skipped: conflict)"
352-
return 0
353-
fi
354349
if [ -n "${no_flake[$hash]:-}" ]; then
355350
if [ "$no_skip_missing" = true ]; then
356351
echo "$(fmt_commit "$hash") (no flake.nix)"
@@ -435,15 +430,27 @@ for hash in "${linear[@]}"; do
435430
fi
436431
done
437432

433+
# Build phase-specific ordered arrays (pre-filtered)
434+
flake_ordered=()
435+
quick_ordered=()
436+
for idx in "${ordered[@]}"; do
437+
hash=${linear[$idx]}
438+
[ -z "${no_flake[$hash]:-}" ] || continue
439+
flake_ordered+=("$idx")
440+
[ -z "${no_quick[$hash]:-}" ] || continue
441+
quick_ordered+=("$idx")
442+
done
443+
444+
# Check each commit message for unresolved work-item markers
438445
# Conflict check — jj conflict trees and git conflict markers
439446
conflict_failed=()
440447
echo "Checking for conflicts..."
441448
for idx in "${ordered[@]}"; do
442449
hash=${linear[$idx]}
443450
reason=""
444-
if git ls-tree --name-only "$hash" 2>/dev/null | grep -qE '^\.jj(conflict-|-do-not-resolve)'; then
451+
if git ls-tree --name-only "$hash" | grep -qE '^\.jj(conflict-|-do-not-resolve)'; then
445452
reason="jj conflict tree"
446-
elif git grep -q -E '<{7}|>{7}|={7}' "$hash" -- 2>/dev/null; then
453+
elif git grep -q -E '<{7}|>{7}|={7}' "$hash" --; then
447454
reason="conflict markers"
448455
fi
449456
if [ -n "$reason" ]; then
@@ -457,22 +464,6 @@ else
457464
echo " all clean"
458465
fi
459466

460-
# Build skip map so flake checks are not wasted on conflicted commits
461-
declare -A conflict_skip
462-
for h in "${conflict_failed[@]}"; do conflict_skip[$h]=1; done
463-
464-
# Build phase-specific ordered arrays (pre-filtered)
465-
flake_ordered=()
466-
quick_ordered=()
467-
for idx in "${ordered[@]}"; do
468-
hash=${linear[$idx]}
469-
[ -z "${conflict_skip[$hash]:-}" ] || continue
470-
[ -z "${no_flake[$hash]:-}" ] || continue
471-
flake_ordered+=("$idx")
472-
[ -z "${no_quick[$hash]:-}" ] || continue
473-
quick_ordered+=("$idx")
474-
done
475-
476467
msg_failed=()
477468
echo "Checking commit messages..."
478469
for idx in "${ordered[@]}"; do
@@ -502,8 +493,8 @@ if git cat-file -e "$tip_hash:.gitignore" 2>/dev/null; then
502493
echo "Checking gitignore monotonicity..."
503494
for idx in "${ordered[@]}"; do
504495
hash=${linear[$idx]}
505-
leaked=$(git ls-tree -r --name-only "$hash" 2>/dev/null |
506-
git -C "$tmpdir/repo" check-ignore --stdin 2>/dev/null || true)
496+
leaked=$(git ls-tree -r --name-only "$hash" |
497+
git -C "$tmpdir/repo" check-ignore --stdin || true)
507498
if [ -n "$leaked" ]; then
508499
first=$(echo "$leaked" | head -1)
509500
count=$(echo "$leaked" | wc -l)

0 commit comments

Comments
 (0)