From 3d41e7f3374650ca6d0f40db822948563f293520 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 22 Sep 2026 09:28:23 +0000 Subject: [PATCH] Notice a renamed post so it gets translated changed_markdown() filtered the push diff to A and M. Git classifies a rename as R, so the file renamed last night never reached the translate step: the post published in Spanish alone, and because the language switcher only renders when .IsTranslated is true, its page shows no ES/DE/PT links at all. --no-renames makes git report the same change as a delete plus an add, and the add is an ordinary translation source. Verified against a real repository: the old filter returned nothing for a rename, the new one returns the new path. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn --- scripts/translate.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/translate.py b/scripts/translate.py index 724fbb5..20ef98c 100644 --- a/scripts/translate.py +++ b/scripts/translate.py @@ -117,10 +117,15 @@ def changed_markdown() -> list[Path]: """Content files touched by the pushed commits.""" head = os.environ.get("CI_COMMIT_SHA", "HEAD") prev = os.environ.get("CI_PREV_COMMIT_SHA", "") + # --no-renames matters: git reports a renamed file as R, which --diff-filter=AM + # drops, so renaming a post made it invisible here and it silently kept the + # siblings of its old name — or, for a post that never had any, got none. + # Without rename detection the same change arrives as D + A, and the A is a + # translation source like any other. if prev and not set(prev) <= {"0"}: - out = run("git", "diff", "--name-only", "--diff-filter=AM", prev, head) + out = run("git", "diff", "--name-only", "--no-renames", "--diff-filter=AM", prev, head) elif run("git", "rev-list", "--count", "HEAD") != "1": - out = run("git", "diff", "--name-only", "--diff-filter=AM", "HEAD~1", "HEAD") + out = run("git", "diff", "--name-only", "--no-renames", "--diff-filter=AM", "HEAD~1", "HEAD") else: # first commit in the repo out = run("git", "ls-files")