Treat Git sources as immutable in lockfile (#6109)

## Summary

We don't need to write metadata for Git sources, since we lock a
specific SHA (and so the metadata is immutable).
This commit is contained in:
Charlie Marsh 2024-08-15 09:26:47 -04:00 committed by GitHub
parent 29179570a1
commit 7dbed4bb2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 121 deletions

View file

@ -1808,8 +1808,10 @@ impl Source {
///
/// We assume that registry sources are immutable. In other words, we expect that once a
/// package-version is published to a registry, its metadata will not change.
///
/// We also assume that Git sources are immutable, since a Git source encodes a specific commit.
fn is_immutable(&self) -> bool {
matches!(self, Self::Registry(..))
matches!(self, Self::Registry(..) | Self::Git(_, _))
}
fn to_toml(&self, table: &mut Table) {