Respect subdirectories when locating Git workspaces (#5944)

## Summary

We were discovering the workspace from the Git repository root, so
attempting to build any subdirectories would fail.

Closes https://github.com/astral-sh/uv/issues/5942.

## Test Plan

```
cargo run pip install \
	git+https://github.com/flyteorg/flytekit.git@master#subdirectory=plugins/flytekit-flyteinteractive
```
This commit is contained in:
Charlie Marsh 2024-08-08 20:13:17 -04:00 committed by GitHub
parent fd1d508108
commit ba7c09edd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 94 additions and 2 deletions

View file

@ -1249,11 +1249,17 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
.await
.map_err(Error::CacheWrite)?;
let path = if let Some(subdirectory) = resource.subdirectory {
Cow::Owned(fetch.path().join(subdirectory))
} else {
Cow::Borrowed(fetch.path())
};
return Ok(ArchiveMetadata::from(
Metadata::from_workspace(
metadata,
fetch.path(),
fetch.path(),
&path,
&path,
self.build_context.sources(),
self.preview_mode,
)