Merge #313 into train 3

This commit is contained in:
pingqiu committed 2026-11-20 16:54:14 -08:00
commit 20dd88c0b4
2 files changed
+13 -1

No files matched your search

@@ -107,6 +107,17 @@ for bad in "$empty" "/nonexistent/post-merge-review-allow.txt"; do
done
rm -f "$empty"
# A list whose last line has no newline keeps that line (here a denial).
unterminated=$(mktemp)
printf '*_test.go\n!core/workspace/*' >"$unterminated"
got=0
printf 'M\0core/workspace/orch_test.go\0' | bash "$check" "$unterminated" >/dev/null 2>&1 || got=$?
[[ $got == 1 ]] || { echo "FAIL allow list with an unterminated last line: exit $got, want 1"; fail=1; }
got=0
printf 'M\0cmd/foo/a_test.go\0' | bash "$check" "$unterminated" >/dev/null 2>&1 || got=$?
[[ $got == 0 ]] || { echo "FAIL allow list with an unterminated last line, allowed path: exit $got, want 0"; fail=1; }
rm -f "$unterminated"
# Real Git: names that git quotes in its default output, a rename out of a
# denied directory, a retarget onto a base that differs, and test deletes.
repo=$(mktemp -d)
+2 -1
View File
@@ -16,7 +16,8 @@ if [[ ! -f $allow_file ]]; then
fi
allow=()
deny=()
while IFS= read -r line; do
# A last line without a newline is read too: dropping it could drop a "!".
while IFS= read -r line || [[ -n $line ]]; do
line=${line%%#*}
line=${line%"${line##*[![:space:]]}"}
line=${line#"${line%%[![:space:]]*}"}