From 6946a704f28f15dcbb72a26e81a91b8db85e214e Mon Sep 17 00:00:00 2001 From: albertlast Date: Sun, 13 Sep 2026 07:10:53 +0200 Subject: [PATCH] Only commits the manifest when update_manifest.php is asked to update_manifest.php creates no branch of its own, so it staged the manifest and committed it onto whatever branch was checked out. Both of its callers want the file regenerated rather than committed: the Docker entrypoint, which runs it against the developer's checkout, and the hint the installer and upgrader show developers when the manifest is out of date. It now writes the manifest and stops, and commits only when given 'commit' as an argument. That is a bare word rather than --commit because PHP reads options after `php -f file` as its own, and `php -f` is how these scripts are documented. ManifestUpdater stages the file inside commit(), so a build that is not committed leaves the index alone. prepare_release.php commits through the same method and is unaffected. Co-Authored-By: Claude Opus 5 Signed-off-by: albertlast --- other/Updaters/ManifestUpdater.php | 16 +++++++++++++++- other/update_manifest.php | 8 +++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/other/Updaters/ManifestUpdater.php b/other/Updaters/ManifestUpdater.php index 7ef7254e242..408afd04835 100644 --- a/other/Updaters/ManifestUpdater.php +++ b/other/Updaters/ManifestUpdater.php @@ -166,7 +166,6 @@ public function execute(): void $this->build(); $this->write(); - $this->gitAdd(); if (php_sapi_name() === 'cli') { echo 'Done.', !$this->hasChanged() ? ' No changes were made.' : '', PHP_EOL; @@ -177,6 +176,21 @@ public function execute(): void $this->removeUselessBranch(); } + /** + * Stages the manifest file, then commits it. + * + * The manifest is a new file at every release, and `git commit -a` only + * picks up files that Git already tracks. + * + * @return bool Whether a commit was made. + */ + public function commit(): bool + { + $this->gitAdd(); + + return parent::commit(); + } + /****************** * Internal methods ******************/ diff --git a/other/update_manifest.php b/other/update_manifest.php index 47d73b47ee7..92152e0f94a 100644 --- a/other/update_manifest.php +++ b/other/update_manifest.php @@ -7,6 +7,10 @@ * Builds a manifest of files that must exist for SMF to function. * The manifest is saved to Sources/Maintenance/manifest.php. * + * To also commit the manifest to the current branch, pass 'commit': + * + * php -f other/update_manifest.php commit + * * Simple Machines Forum (SMF) * * @package SMF @@ -29,7 +33,9 @@ $updater = new Updaters\ManifestUpdater(); $updater->execute(); -if ($updater->hasChanged()) { +// Committing is left to the 'commit' argument: this also regenerates the +// manifest for local install and upgrade testing, which should leave Git alone. +if (($argv[1] ?? null) === 'commit' && $updater->hasChanged()) { if (!$updater->ready_to_commit) { echo 'Changes are not ready to commit. Deal with them manually.' . PHP_EOL; } elseif ($updater->commit()) {