@@ -541,6 +541,9 @@ impl<'cb> FetchOptions<'cb> {
541
541
}
542
542
543
543
/// Set fetch depth, a value less or equal to 0 is interpreted as pull everything (effectively the same as not declaring a limit depth)
544
+
545
+ // FIXME(blyxyas): We currently don't have a test for shallow functions
546
+ // because libgit2 doesn't support local shallow clones. https://github.com/rust-lang/git2-rs/pull/979#issuecomment-1716299900
544
547
pub fn depth ( & mut self , depth : i32 ) -> & mut Self {
545
548
if depth. is_negative ( ) {
546
549
self . depth = 0 ;
@@ -756,7 +759,6 @@ impl RemoteRedirect {
756
759
757
760
#[ cfg( test) ]
758
761
mod tests {
759
- use crate :: build:: RepoBuilder ;
760
762
use crate :: { AutotagOption , PushOptions } ;
761
763
use crate :: { Direction , FetchOptions , Remote , RemoteCallbacks , Repository } ;
762
764
use std:: cell:: Cell ;
@@ -1120,43 +1122,4 @@ mod tests {
1120
1122
assert_eq ! ( flag, 7 ) ;
1121
1123
assert_eq ! ( remote_repo. branches( None ) . unwrap( ) . count( ) , 3 ) ;
1122
1124
}
1123
-
1124
- #[ test]
1125
- fn shallow_clone ( ) {
1126
- let ( td, repo) = crate :: test:: repo_init ( ) ;
1127
-
1128
- let commit = repo. head ( ) . unwrap ( ) . target ( ) . unwrap ( ) ;
1129
- let first_commit = repo. find_commit ( commit) . unwrap ( ) ;
1130
-
1131
- let sig = repo. signature ( ) . unwrap ( ) ;
1132
- let mut index = repo. index ( ) . unwrap ( ) ;
1133
- let tree = index. write_tree ( ) . unwrap ( ) ;
1134
- let tree = repo. find_tree ( tree) . unwrap ( ) ;
1135
-
1136
- let second_commit = repo. commit (
1137
- Some ( "HEAD" ) ,
1138
- & sig,
1139
- & sig,
1140
- "second commit" ,
1141
- & tree,
1142
- & [ & first_commit]
1143
- ) . unwrap ( ) ;
1144
-
1145
- let td2 = TempDir :: new ( ) . unwrap ( ) ;
1146
- let mut fo = FetchOptions :: new ( ) ;
1147
- fo. depth ( 1 ) ;
1148
-
1149
- let new_repo = RepoBuilder :: new ( )
1150
- . fetch_options ( fo)
1151
- . clone ( & td. into_path ( ) . as_os_str ( ) . to_str ( ) . unwrap ( ) , td2. path ( ) )
1152
- . unwrap ( ) ;
1153
-
1154
- dbg ! ( new_repo. is_shallow( ) ) ;
1155
-
1156
- let _ = dbg ! ( new_repo. find_commit( first_commit. id( ) ) ) ; // ????
1157
- let _ = dbg ! ( new_repo. find_commit( second_commit) ) ;
1158
-
1159
- // Check that there's only one commit
1160
- panic ! ( ) ;
1161
- }
1162
1125
}
0 commit comments