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()) {