Include Git member information when getting metadata from cache (#9388)

## Summary

Include the `git_member` when fetching metadata from cache.

h/t to @PhilipVinc for the suggested fix

Resolves #8887 

## Test Plan

Pending

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
Eric Mark Martin 2024-12-03 00:07:21 -05:00 committed by GitHub
parent 4ec9ad2537
commit 16ca0c34a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 222 additions and 7 deletions

View file

@ -1378,13 +1378,14 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
Cow::Borrowed(fetch.path())
};
let git_member = GitWorkspaceMember {
fetch_root: fetch.path(),
git_source: resource,
};
if let Some(metadata) =
Self::read_static_metadata(source, fetch.path(), resource.subdirectory).await?
{
let git_member = GitWorkspaceMember {
fetch_root: fetch.path(),
git_source: resource,
};
return Ok(ArchiveMetadata::from(
Metadata::from_workspace(
metadata,
@ -1416,12 +1417,17 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
Cow::Borrowed(fetch.path())
};
let git_member = GitWorkspaceMember {
fetch_root: fetch.path(),
git_source: resource,
};
debug!("Using cached metadata for: {source}");
return Ok(ArchiveMetadata::from(
Metadata::from_workspace(
metadata.into(),
&path,
None,
Some(&git_member),
self.build_context.locations(),
self.build_context.sources(),
self.build_context.bounds(),
@ -1454,7 +1460,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
Metadata::from_workspace(
metadata,
&path,
None,
Some(&git_member),
self.build_context.locations(),
self.build_context.sources(),
self.build_context.bounds(),
@ -1502,7 +1508,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
Metadata::from_workspace(
metadata,
fetch.path(),
None,
Some(&git_member),
self.build_context.locations(),
self.build_context.sources(),
self.build_context.bounds(),