perf: shallow clone dependency repos

This commit is contained in:
daimond113 2024-10-20 17:13:58 +02:00
parent f0d19bb5e1
commit 92c6120d24
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
2 changed files with 6 additions and 1 deletions

View file

@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Use updated aliases when reusing lockfile dependencies by @daimond113
- Listen for device flow completion without requiring pressing enter by @daimond113
### Performance
- Clone dependency repos shallowly by @daimond113
## [0.5.0-rc.6] - 2024-10-14
### Added
- Support full version requirements in workspace version field by @daimond113

View file

@ -3,7 +3,7 @@ use crate::{
util::authenticate_conn,
};
use anyhow::Context;
use gix::remote::Direction;
use gix::remote::{fetch::Shallow, Direction};
use pesde::Project;
use std::path::Path;
@ -33,6 +33,7 @@ fn update_repo<P: AsRef<Path>>(
let results = connection
.prepare_fetch(gix::progress::Discard, Default::default())
.context(format!("failed to prepare {name} repository fetch"))?
.with_shallow(Shallow::Deepen(1))
.receive(gix::progress::Discard, &false.into())
.context(format!("failed to receive new {name} repository contents"))?;
@ -89,6 +90,7 @@ fn update_repo<P: AsRef<Path>>(
gix::prepare_clone(url, path)
.context(format!("failed to prepare {name} repository clone"))?
.with_shallow(Shallow::Deepen(1))
.fetch_then_checkout(gix::progress::Discard, &false.into())
.context(format!("failed to fetch and checkout {name} repository"))?
.0