mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-30 11:37:24 +00:00
Combine fetch and resolve steps in Git resolver (#5886)
## Summary Whenever we call `resolve`, we immediately call `fetch` after. And in some cases `resolve` actually calls `fetch` internally. It seems a lot simpler to just merge these into one method that returns a `Fetch` (which itself contains the fully-resolved URL). Closes https://github.com/astral-sh/uv/issues/5876.
This commit is contained in:
parent
7523673f39
commit
bc1d7764e2
3 changed files with 6 additions and 79 deletions
|
|
@ -1121,29 +1121,12 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
return Err(Error::HashesNotSupportedGit(source.to_string()));
|
||||
}
|
||||
|
||||
// Resolve to a precise Git SHA.
|
||||
let url = if let Some(url) = self
|
||||
.build_context
|
||||
.git()
|
||||
.resolve(
|
||||
resource.git,
|
||||
client.unmanaged.uncached_client().client(),
|
||||
self.build_context.cache().bucket(CacheBucket::Git),
|
||||
self.reporter.clone().map(Facade::from),
|
||||
)
|
||||
.await?
|
||||
{
|
||||
Cow::Owned(url)
|
||||
} else {
|
||||
Cow::Borrowed(resource.git)
|
||||
};
|
||||
|
||||
// Fetch the Git repository.
|
||||
let fetch = self
|
||||
.build_context
|
||||
.git()
|
||||
.fetch(
|
||||
&url,
|
||||
resource.git,
|
||||
client.unmanaged.uncached_client().client(),
|
||||
self.build_context.cache().bucket(CacheBucket::Git),
|
||||
self.reporter.clone().map(Facade::from),
|
||||
|
|
@ -1208,29 +1191,12 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
return Err(Error::HashesNotSupportedGit(source.to_string()));
|
||||
}
|
||||
|
||||
// Resolve to a precise Git SHA.
|
||||
let url = if let Some(url) = self
|
||||
.build_context
|
||||
.git()
|
||||
.resolve(
|
||||
resource.git,
|
||||
client.unmanaged.uncached_client().client(),
|
||||
self.build_context.cache().bucket(CacheBucket::Git),
|
||||
self.reporter.clone().map(Facade::from),
|
||||
)
|
||||
.await?
|
||||
{
|
||||
Cow::Owned(url)
|
||||
} else {
|
||||
Cow::Borrowed(resource.git)
|
||||
};
|
||||
|
||||
// Fetch the Git repository.
|
||||
let fetch = self
|
||||
.build_context
|
||||
.git()
|
||||
.fetch(
|
||||
&url,
|
||||
resource.git,
|
||||
client.unmanaged.uncached_client().client(),
|
||||
self.build_context.cache().bucket(CacheBucket::Git),
|
||||
self.reporter.clone().map(Facade::from),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue