@@ -41,6 +41,7 @@ pub struct RemoteHead<'remote> {
4141/// Options which can be specified to various fetch operations.
4242pub struct FetchOptions < ' cb > {
4343 callbacks : Option < RemoteCallbacks < ' cb > > ,
44+ depth : i32 ,
4445 proxy : Option < ProxyOptions < ' cb > > ,
4546 prune : FetchPrune ,
4647 update_fetchhead : bool ,
@@ -509,6 +510,7 @@ impl<'cb> FetchOptions<'cb> {
509510 follow_redirects : RemoteRedirect :: Initial ,
510511 custom_headers : Vec :: new ( ) ,
511512 custom_headers_ptrs : Vec :: new ( ) ,
513+ depth : 0 // Not limited depth
512514 }
513515 }
514516
@@ -538,6 +540,12 @@ impl<'cb> FetchOptions<'cb> {
538540 self
539541 }
540542
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+
541549 /// Set how to behave regarding tags on the remote, such as auto-downloading
542550 /// tags for objects we're downloading or downloading all of them.
543551 ///
@@ -590,7 +598,7 @@ impl<'cb> Binding for FetchOptions<'cb> {
590598 prune : crate :: call:: convert ( & self . prune ) ,
591599 update_fetchhead : crate :: call:: convert ( & self . update_fetchhead ) ,
592600 download_tags : crate :: call:: convert ( & self . download_tags ) ,
593- depth : 0 , // GIT_FETCH_DEPTH_FULL.
601+ depth : self . depth ,
594602 follow_redirects : self . follow_redirects . raw ( ) ,
595603 custom_headers : git_strarray {
596604 count : self . custom_headers_ptrs . len ( ) ,
0 commit comments