@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Correct the behavior of "bin/repository discover --repair"

Summary:
Ref T13591. Since D8781, this flag does not function correctly in Git and Mercurial repositories, since ref discovery pre-fills the cache.

Move the "don't look at the database" behavior the flag enables into the cache lookup. D8781 should have been slightly more aggressive and done this, it was just overlooked.

Test Plan:
- Ran `bin/repository discover --help` and read the updated help text.
- Ran `bin/repository discover --repair` in a fully-discovered Git repository.
- Before: no effect.
- After: full rediscovery.

Maniphest Tasks: T13591

Differential Revision: https://secure.phabricator.com/D21513

+16 -15
+7 -7
src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
··· 459 459 return true; 460 460 } 461 461 462 - if ($this->repairMode) { 463 - // In repair mode, rediscover the entire repository, ignoring the 464 - // database state. We can hit the local cache above, but if we miss it 465 - // stop the script from going to the database cache. 466 - return false; 467 - } 468 - 469 462 $this->fillCommitCache(array($identifier)); 470 463 471 464 return isset($this->commitCache[$identifier]); ··· 473 466 474 467 private function fillCommitCache(array $identifiers) { 475 468 if (!$identifiers) { 469 + return; 470 + } 471 + 472 + if ($this->repairMode) { 473 + // In repair mode, rediscover the entire repository, ignoring the 474 + // database state. The engine still maintains a local cache (the 475 + // "Working Set") but we just give up before looking in the database. 476 476 return; 477 477 } 478 478
+9 -8
src/applications/repository/management/PhabricatorRepositoryManagementDiscoverWorkflow.php
··· 7 7 $this 8 8 ->setName('discover') 9 9 ->setExamples('**discover** [__options__] __repository__ ...') 10 - ->setSynopsis(pht('Discover __repository__.')) 10 + ->setSynopsis(pht('Discover commits in __repository__.')) 11 11 ->setArguments( 12 12 array( 13 13 array( 14 - 'name' => 'verbose', 15 - 'help' => pht('Show additional debugging information.'), 14 + 'name' => 'verbose', 15 + 'help' => pht('Show additional debugging information.'), 16 16 ), 17 17 array( 18 - 'name' => 'repair', 19 - 'help' => pht( 20 - 'Repair a repository with gaps in commit history.'), 18 + 'name' => 'repair', 19 + 'help' => pht( 20 + 'Discover all commits, even if they are ancestors of known '. 21 + 'commits. This can repair gaps in repository history.'), 21 22 ), 22 23 array( 23 - 'name' => 'repos', 24 - 'wildcard' => true, 24 + 'name' => 'repos', 25 + 'wildcard' => true, 25 26 ), 26 27 )); 27 28 }