From 9bb7804d5f5582892b915025cbbfcf630a232892 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Sat, 25 Apr 2026 23:20:45 +0100 Subject: [PATCH] check-for-epoch-bump: enforce epoch bump when package moves between dirs When a package is moved between os/, enterprise-packages/, and extra-packages/, look up all three candidate paths on main so the previous version/epoch is found and a bump is still required. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- scripts/check-for-epoch-bump.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/check-for-epoch-bump.sh b/scripts/check-for-epoch-bump.sh index 1ee3a0a..0c4f669 100755 --- a/scripts/check-for-epoch-bump.sh +++ b/scripts/check-for-epoch-bump.sh @@ -45,7 +45,19 @@ for yaml_file in "$@"; do # Extract version and epoch from the file on the main branch using git show # Treat missing file as version 0 and epoch 0 - main_content="$(git show main:"$yaml_file" 2>/dev/null)" + # Try all three known package directories so epoch bumps are enforced when + # a package is moved between os/, enterprise-packages/, and extra-packages/. + first_component="${yaml_file%%/*}" + rest_of_path="${yaml_file#*/}" + main_content="" + if [[ "$first_component" == "os" || "$first_component" == "enterprise-packages" || "$first_component" == "extra-packages" ]]; then + for prefix in "os" "enterprise-packages" "extra-packages"; do + main_content="$(git show main:"${prefix}/${rest_of_path}" 2>/dev/null)" + [ -n "$main_content" ] && break + done + else + main_content="$(git show main:"$yaml_file" 2>/dev/null)" + fi if [ -z "$main_content" ]; then version_main="0" epoch_main="0"