Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion other/Updaters/ManifestUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
******************/
Expand Down
8 changes: 7 additions & 1 deletion other/update_manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()) {
Expand Down