From 32172c88d4bfbfb862093f61e53a812621416449 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Thu, 9 Jan 2025 10:28:54 +0800 Subject: [PATCH] Avoid partial match Signed-off-by: Chenxiong Qi --- hack/validate-migration.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hack/validate-migration.sh b/hack/validate-migration.sh index 889fc28089..ca03e9a872 100755 --- a/hack/validate-migration.sh +++ b/hack/validate-migration.sh @@ -259,11 +259,12 @@ list_migration_files() { case "$status" in A) # file is added task_dir_path=$(awk -F '/' '{ OFS = "/"; print $1, $2 }' <<<"$origin_path") - if grep -q "$task_dir_path" <<<"$seen"; then + if grep -q "^${task_dir_path}$" <<<"$seen"; then echo "error: There must be one migration file per task in a single pull request." >&2 return 1 else - seen="$seen $task_dir_path" + seen="$seen +$task_dir_path" echo "$origin_path" fi ;;