1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

When a commit is marked "closeable", clear the "published" flag

Summary:
Ref T13552. When a previously discovered commit becomes reachable from a permanent ref, we re-queue workers to update it. However, the commit may already be marked as "published", so the publish worker may do nothing.

It would perhaps be simpler to not mark the commit as published when it isn't reachable from a permanent ref, but this is tricky because the flag is also part of the "imported / all steps" state (see T13580).

Until that can be cleaned up, just clear the flag.

Test Plan:
  - Pushed a commit with "fixes X" to a non-permanent branch.
  - Pushed it to a permanent branch.
  - Before change: task failed to close.
  - After change: task closes properly.

Maniphest Tasks: T13552

Differential Revision: https://secure.phabricator.com/D21460
This commit is contained in:
epriestley 2020-09-08 12:51:09 -07:00
parent 737e7c8541
commit 6f78e2a91c

View file

@ -553,6 +553,7 @@ final class PhabricatorRepositoryRefEngine
}
$closeable_flag = PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE;
$published_flag = PhabricatorRepositoryCommit::IMPORTED_PUBLISH;
$all_commits = ipull($all_commits, null, 'commitIdentifier');
foreach ($identifiers as $identifier) {
@ -566,12 +567,21 @@ final class PhabricatorRepositoryRefEngine
$identifier));
}
if (!($row['importStatus'] & $closeable_flag)) {
$import_status = $row['importStatus'];
if (!($import_status & $closeable_flag)) {
// Set the "closeable" flag.
$import_status = ($import_status | $closeable_flag);
// See T13580. Clear the "published" flag, so publishing executes
// again. We may have previously performed a no-op "publish" on the
// commit to make sure it has all bits in the "IMPORTED_ALL" bitmask.
$import_status = ($import_status & ~$published_flag);
queryfx(
$conn,
'UPDATE %T SET importStatus = (importStatus | %d) WHERE id = %d',
'UPDATE %T SET importStatus = %d WHERE id = %d',
$commit_table->getTableName(),
$closeable_flag,
$import_status,
$row['id']);
$data = array(