summaryrefslogtreecommitdiff
path: root/lockfile/lib.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-02-27 21:02:19 +0100
committerGitHub <noreply@github.com>2023-02-27 16:02:19 -0400
commitc6c747873f20c96c59393dd4d8f6a89e10ffb700 (patch)
treec18e2e9e6eb37779489eb6f124621ea631930915 /lockfile/lib.rs
parent92ba46c384806af171f1ad9c0040146a50531e84 (diff)
fix(lockfile): don't touch lockfile is npm specifiers are identical (#17973)
We were unconditionally inserting npm specifiers into the lockfile, marking it as "dirty" and requiring saving.
Diffstat (limited to 'lockfile/lib.rs')
-rw-r--r--lockfile/lib.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/lockfile/lib.rs b/lockfile/lib.rs
index b8caac86c..616a8da98 100644
--- a/lockfile/lib.rs
+++ b/lockfile/lib.rs
@@ -297,12 +297,17 @@ Use \"--lock-write\" flag to regenerate the lockfile at \"{}\".",
serialized_package_req: String,
serialized_package_id: String,
) {
+ let maybe_prev = self.content.npm.specifiers.get(&serialized_package_req);
+
+ if maybe_prev.is_none() || maybe_prev != Some(&serialized_package_id) {
+ self.has_content_changed = true;
+ }
+
self
.content
.npm
.specifiers
.insert(serialized_package_req, serialized_package_id);
- self.has_content_changed = true;
}
}