Some MediaWiki translation exports fail while creating commits with:
.git/hooks/commit-msg: 2: Syntax error: newline unexpected error: cannot rebase: Your index contains uncommitted changes. error: Please commit or stash them.
Investigation found that some .git/hooks/commit-msg files contain a Wikimedia 429 "Too many requests" HTML response instead of the Gerrit commit message hook.
clupdate-git-repo currently downloads the Gerrit hook when it is missing. With many MediaWiki repositories this can result in rate limiting (because we are not setting an User-Agent), and a failed HTTP response can be left behind as an executable hook. Since the file then exists, subsequent runs do not repair it.
Expected behavior
- MediaWiki Gerrit export repositories have a valid Gerrit commit-msg hook without requiring repeated downloads from Gerrit.
- Existing broken hooks can be repaired/replaced automatically.
- Repository update/export/commit operations remain safe to rerun.
- Translation exports can create commits with the expected Gerrit Change-Id and do not fail because of an invalid commit-msg hook.
Implementation notes
The proposed change in change 1341700 provides the Gerrit commit message hook locally and adjusts the symlink handling in clupdate-git-repo.
Dependencies / prerequisites
No known dependencies.
No configuration, schema, or documentation changes are required.
QA plan
The main regression risk is breaking repository setup or replacing an intentional hook incorrectly.
Before deployment:
- Run the relevant repository update/setup logic against a test/temporary checkout and verify that the resulting commit-msg hook is valid and executable. (Done while developing)
- Verify that running the setup again is idempotent.
- Verify that an existing invalid/broken hook is repaired as intended.
After deploying to translatewiki.net:
- Update one repository known to have the broken HTML hook, such as AdvancedSearch.
- Verify that the hook has been repaired.
- Run the export/commit flow for the repository and verify that a commit can be created with a Gerrit Change-Id.
- Re-run the previously failing MediaWiki export flow and verify that there are no remaining failures caused by invalid commit-msg hooks.
There is no separate staging environment for the translatewiki.net export checkouts, so the final integration verification is performed on translatewiki.net after deployment.