rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.67k stars 384 forks source link

Plan to implement `--depth` option? #875

Closed kyoheiu closed 2 years ago

kyoheiu commented 2 years ago

It would be great if this crate implements --depth option in FetchOptions, For example,

  let mut fo = git2::FetchOptions::new();
  fo.depth(1);

  // Prepare builder.
  let mut builder = git2::build::RepoBuilder::new();
  builder.fetch_options(fo);

  // Clone the project.
  builder.clone(
    "git@github.com:rust-lang/git2-rs.git",
    Path::new("/tmp/git2-rs"),
  );
extrawurst commented 2 years ago

Probably better to add as a request upstream in libgit2

ehuss commented 2 years ago

This is a libgit2 limitation. Closing as a duplicate of https://github.com/libgit2/libgit2/issues/3058.

RCasatta commented 1 year ago

It looks it's not a limitation anymore: https://github.com/libgit2/libgit2/issues/3058#issuecomment-1540940627