Skip to content

Commit

Permalink
Skip up-to-date recipes when using sync-recipes --force
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Dec 20, 2018
1 parent 8ad5578 commit 8a4d1d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Flex.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@ private function fetchRecipes(): array
$job = $operation->getJobType();

if ($operation instanceof InstallOperation && isset($locks[$name])) {
$ref = $this->lock->get($name)['recipe']['ref'] ?? null;
if ($ref && ($locks[$name]['recipe']['ref'] ?? null) === $ref) {
continue;
}
$this->lock->add($name, $locks[$name]);
} elseif ($operation instanceof UninstallOperation) {
$this->lock->remove($name);
Expand Down
5 changes: 5 additions & 0 deletions src/Lock.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public function has($name): bool
return array_key_exists($name, $this->lock);
}

public function get($name)
{
return $this->lock[$name] ?? null;
}

public function add($name, $data)
{
$this->lock[$name] = $data;
Expand Down

0 comments on commit 8a4d1d7

Please sign in to comment.