@@ -2092,15 +2092,20 @@ fn gitoxide_clones_git_dependency_with_shallow_protocol_and_follow_up_fetch_main
2092
2092
. masquerade_as_nightly_cargo ( & [ "unstable features must be available for -Z gitoxide" ] )
2093
2093
. run ( ) ;
2094
2094
2095
- let db_clone = gix:: open_opts (
2096
- glob:: glob ( paths:: home ( ) . join ( ".cargo/git/db/bar-*" ) . to_str ( ) . unwrap ( ) ) ?
2097
- . next ( )
2098
- . unwrap ( ) ?,
2095
+ let shallow_db_clone = gix:: open_opts (
2096
+ glob:: glob (
2097
+ paths:: home ( )
2098
+ . join ( ".cargo/git/db/bar-*-shallow" )
2099
+ . to_str ( )
2100
+ . unwrap ( ) ,
2101
+ ) ?
2102
+ . next ( )
2103
+ . unwrap ( ) ?,
2099
2104
gix:: open:: Options :: isolated ( ) ,
2100
2105
) ?;
2101
- assert ! ( db_clone . is_shallow( ) ) ;
2106
+ assert ! ( shallow_db_clone . is_shallow( ) ) ;
2102
2107
assert_eq ! (
2103
- db_clone
2108
+ shallow_db_clone
2104
2109
. rev_parse_single( "origin/master" ) ?
2105
2110
. ancestors( )
2106
2111
. all( ) ?
@@ -2145,16 +2150,24 @@ fn gitoxide_clones_git_dependency_with_shallow_protocol_and_follow_up_fetch_main
2145
2150
. masquerade_as_nightly_cargo ( & [ "unstable features must be available for -Z gitoxide" ] )
2146
2151
. run ( ) ;
2147
2152
2153
+ let db_clone = gix:: open_opts (
2154
+ glob:: glob ( paths:: home ( ) . join ( ".cargo/git/db/bar-*" ) . to_str ( ) . unwrap ( ) ) ?
2155
+ . map ( Result :: unwrap)
2156
+ . filter ( |p| !p. to_string_lossy ( ) . ends_with ( "-shallow" ) )
2157
+ . next ( )
2158
+ . unwrap ( ) ,
2159
+ gix:: open:: Options :: isolated ( ) ,
2160
+ ) ?;
2148
2161
assert_eq ! (
2149
2162
db_clone
2150
2163
. rev_parse_single( "origin/master" ) ?
2151
2164
. ancestors( )
2152
2165
. all( ) ?
2153
2166
. count( ) ,
2154
- 2 ,
2155
- "the new commit was fetched into our DB clone"
2167
+ 3 ,
2168
+ "we created an entirely new non-shallow clone"
2156
2169
) ;
2157
- assert ! ( db_clone. is_shallow( ) ) ;
2170
+ assert ! ( ! db_clone. is_shallow( ) ) ;
2158
2171
assert_eq ! (
2159
2172
dep_checkout. head_id( ) ?. ancestors( ) . all( ) ?. count( ) ,
2160
2173
1 ,
@@ -2168,8 +2181,14 @@ fn gitoxide_clones_git_dependency_with_shallow_protocol_and_follow_up_fetch_main
2168
2181
. unwrap ( ) ,
2169
2182
) ?
2170
2183
. map ( |path| -> anyhow:: Result < usize > {
2171
- let dep_checkout = gix:: open_opts ( path?, gix:: open:: Options :: isolated ( ) ) ?;
2172
- assert ! ( dep_checkout. is_shallow( ) ) ;
2184
+ let path = path?;
2185
+ let dep_checkout = gix:: open_opts ( & path, gix:: open:: Options :: isolated ( ) ) ?;
2186
+ dbg ! ( dep_checkout. git_dir( ) ) ;
2187
+ assert_eq ! (
2188
+ dep_checkout. is_shallow( ) ,
2189
+ path. to_string_lossy( ) . contains( "-shallow" ) ,
2190
+ "checkouts of shallow db repos are shallow as well"
2191
+ ) ;
2173
2192
let depth = dep_checkout. head_id ( ) ?. ancestors ( ) . all ( ) ?. count ( ) ;
2174
2193
Ok ( depth)
2175
2194
} )
@@ -2178,8 +2197,8 @@ fn gitoxide_clones_git_dependency_with_shallow_protocol_and_follow_up_fetch_main
2178
2197
. expect ( "two checkout repos" ) ;
2179
2198
2180
2199
assert_eq ! (
2181
- max_history_depth, 2 ,
2182
- "the new checkout sees all commits of the DB "
2200
+ max_history_depth, 3 ,
2201
+ "we see the previous shallow checkout as well as new new unshallow one "
2183
2202
) ;
2184
2203
2185
2204
Ok ( ( ) )
0 commit comments