Skip to content

Commit 9bb7804

Browse files
xnoxclaude
andcommitted
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) <noreply@anthropic.com>
1 parent e23d002 commit 9bb7804

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

scripts/check-for-epoch-bump.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,19 @@ for yaml_file in "$@"; do
4545

4646
# Extract version and epoch from the file on the main branch using git show
4747
# Treat missing file as version 0 and epoch 0
48-
main_content="$(git show main:"$yaml_file" 2>/dev/null)"
48+
# Try all three known package directories so epoch bumps are enforced when
49+
# a package is moved between os/, enterprise-packages/, and extra-packages/.
50+
first_component="${yaml_file%%/*}"
51+
rest_of_path="${yaml_file#*/}"
52+
main_content=""
53+
if [[ "$first_component" == "os" || "$first_component" == "enterprise-packages" || "$first_component" == "extra-packages" ]]; then
54+
for prefix in "os" "enterprise-packages" "extra-packages"; do
55+
main_content="$(git show main:"${prefix}/${rest_of_path}" 2>/dev/null)"
56+
[ -n "$main_content" ] && break
57+
done
58+
else
59+
main_content="$(git show main:"$yaml_file" 2>/dev/null)"
60+
fi
4961
if [ -z "$main_content" ]; then
5062
version_main="0"
5163
epoch_main="0"

0 commit comments

Comments
 (0)