Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
blyxyas committed Aug 9, 2023
1 parent 67676d2 commit d505ce1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
17 changes: 8 additions & 9 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,14 @@ impl<'cb> RepoBuilder<'cb> {

/// Specify fetch depth, a value less than zero is interpreted as pull everything (effectively the same as no declaring a limit depth)
pub fn depth(&mut self, depth: i32) -> &mut RepoBuilder<'cb> {
if !self.fetch_opts
.as_mut()
.is_some_and(|fetch_opts| {
fetch_opts.depth(depth); true
}) {
let mut fo = FetchOptions::new();
fo.depth(depth);
self.fetch_options(fo);
}
if !self.fetch_opts.as_mut().is_some_and(|fetch_opts| {
fetch_opts.depth(depth);
true
}) {
let mut fo = FetchOptions::new();
fo.depth(depth);
self.fetch_options(fo);
}

self
// if let Some(ref fetch_opts) = &self.fetch_opts {
Expand Down
2 changes: 1 addition & 1 deletion src/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ impl<'cb> FetchOptions<'cb> {
follow_redirects: RemoteRedirect::Initial,
custom_headers: Vec::new(),
custom_headers_ptrs: Vec::new(),
depth: 0 // Not limited depth
depth: 0, // Not limited depth
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ impl Repository {
}

/// Clone a remote repository with a depth of one (shallow cloning)
///
///
/// Similar to `git clone --depth 1`
pub fn shallow_clone<P: AsRef<Path>>(url: &str, into: P) -> Result<Repository, Error> {
RepoBuilder::new().depth(1).clone(url, into.as_ref())
Expand Down

0 comments on commit d505ce1

Please sign in to comment.