@@ -41,6 +41,7 @@ pub struct RemoteHead<'remote> {
41
41
/// Options which can be specified to various fetch operations.
42
42
pub struct FetchOptions < ' cb > {
43
43
callbacks : Option < RemoteCallbacks < ' cb > > ,
44
+ depth : i32 ,
44
45
proxy : Option < ProxyOptions < ' cb > > ,
45
46
prune : FetchPrune ,
46
47
update_fetchhead : bool ,
@@ -509,6 +510,7 @@ impl<'cb> FetchOptions<'cb> {
509
510
follow_redirects : RemoteRedirect :: Initial ,
510
511
custom_headers : Vec :: new ( ) ,
511
512
custom_headers_ptrs : Vec :: new ( ) ,
513
+ depth : 0 // Not limited depth
512
514
}
513
515
}
514
516
@@ -538,6 +540,12 @@ impl<'cb> FetchOptions<'cb> {
538
540
self
539
541
}
540
542
543
+ /// Set fetch depth, a value less than zero is interpreted as pull everything (effectively the same as no declaring a limit depth)
544
+ pub fn depth ( & mut self , depth : i32 ) -> & mut Self {
545
+ self . depth = depth;
546
+ self
547
+ }
548
+
541
549
/// Set how to behave regarding tags on the remote, such as auto-downloading
542
550
/// tags for objects we're downloading or downloading all of them.
543
551
///
@@ -590,7 +598,7 @@ impl<'cb> Binding for FetchOptions<'cb> {
590
598
prune : crate :: call:: convert ( & self . prune ) ,
591
599
update_fetchhead : crate :: call:: convert ( & self . update_fetchhead ) ,
592
600
download_tags : crate :: call:: convert ( & self . download_tags ) ,
593
- depth : 0 , // GIT_FETCH_DEPTH_FULL.
601
+ depth : self . depth ,
594
602
follow_redirects : self . follow_redirects . raw ( ) ,
595
603
custom_headers : git_strarray {
596
604
count : self . custom_headers_ptrs . len ( ) ,
0 commit comments