Skip to content

Commit 6172d45

Browse files
committed
struct defs changes for supporting shallow clone
* New struct `git_fetch_negotiation` * New field `depth` for `git_fetch_options` * New callback `git_transport->shallow_roots`. * Updated `git_transport->negotiate_fetch` param with `git_fetch_negotiation`. *
1 parent dcd6d9f commit 6172d45

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

libgit2-sys/lib.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,20 @@ pub struct git_fetch_options {
394394
pub update_fetchhead: c_int,
395395
pub download_tags: git_remote_autotag_option_t,
396396
pub proxy_opts: git_proxy_options,
397+
pub depth: c_int,
397398
pub follow_redirects: git_remote_redirect_t,
398399
pub custom_headers: git_strarray,
399400
}
400401

402+
#[repr(C)]
403+
pub struct git_fetch_negotiation {
404+
refs: *const *const git_remote_head,
405+
refs_len: size_t,
406+
shallow_roots: *mut git_oid,
407+
shallow_roots_len: size_t,
408+
depth: c_int,
409+
}
410+
401411
git_enum! {
402412
pub enum git_remote_autotag_option_t {
403413
GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED,
@@ -1406,10 +1416,11 @@ pub struct git_transport {
14061416
extern "C" fn(
14071417
transport: *mut git_transport,
14081418
repo: *mut git_repository,
1409-
refs: *const *const git_remote_head,
1410-
count: size_t,
1419+
fetch_data: *const git_fetch_negotiation,
14111420
) -> c_int,
14121421
>,
1422+
pub shallow_roots:
1423+
Option<extern "C" fn(out: *mut git_oidarray, transport: *mut git_transport) -> c_int>,
14131424
pub download_pack: Option<
14141425
extern "C" fn(
14151426
transport: *mut git_transport,

src/remote.rs

+1
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ impl<'cb> Binding for FetchOptions<'cb> {
588588
prune: crate::call::convert(&self.prune),
589589
update_fetchhead: crate::call::convert(&self.update_fetchhead),
590590
download_tags: crate::call::convert(&self.download_tags),
591+
depth: 0, // GIT_FETCH_DEPTH_FULL.
591592
follow_redirects: self.follow_redirects.raw(),
592593
custom_headers: git_strarray {
593594
count: self.custom_headers_ptrs.len(),

0 commit comments

Comments
 (0)