Skip to content

Commit

Permalink
fix: fix git dependencies comparison on bootstrap
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Felipe C. C. Pinto <[email protected]>
  • Loading branch information
mateusfccp committed Mar 13, 2024
1 parent c5ab053 commit 9020222
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/melos/lib/src/commands/bootstrap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,14 @@ mixin _BootstrapMixin on _CleanMixin {
return didUpdate;
}

bool _areDependenciesEqual(DependencyReference? a, DependencyReference? b) {
if (a is GitReference && b is GitReference) {
return a == b && a.path == b.path;
} else {
return a == b;
}
}

int _updateDependencies({
required YamlEditor pubspecEditor,
required Map<String, DependencyReference>? workspaceDependencies,
Expand All @@ -343,8 +351,7 @@ mixin _BootstrapMixin on _CleanMixin {
// dependencies that have a different version specified in the workspace.
final dependenciesToUpdate = workspaceDependencies.entries.where((entry) {
if (!packageDependencies.containsKey(entry.key)) return false;
if (packageDependencies[entry.key] == entry.value) return false;
return true;
return !_areDependenciesEqual(packageDependencies[entry.key], entry.value);
});

for (final entry in dependenciesToUpdate) {
Expand Down

0 comments on commit 9020222

Please sign in to comment.