File tree 3 files changed +20
-6
lines changed 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -560,11 +560,10 @@ impl GlobalCacheTracker {
560
560
) -> CargoResult < ( ) > {
561
561
let _p = crate :: util:: profile:: start ( "cleaning global cache files" ) ;
562
562
let config = clean_ctx. config ;
563
- let base_git_path = config. git_path ( ) . into_path_unlocked ( ) ;
564
563
let base = BasePaths {
565
564
index : config. registry_index_path ( ) . into_path_unlocked ( ) ,
566
- git_db : base_git_path . join ( "db" ) ,
567
- git_co : base_git_path . join ( "checkouts" ) ,
565
+ git_db : config . git_db_path ( ) . into_path_unlocked ( ) ,
566
+ git_co : config . git_checkouts_path ( ) . into_path_unlocked ( ) ,
568
567
crate_dir : config. registry_cache_path ( ) . into_path_unlocked ( ) ,
569
568
src : config. registry_source_path ( ) . into_path_unlocked ( ) ,
570
569
} ;
Original file line number Diff line number Diff line change @@ -248,7 +248,8 @@ impl<'cfg> Source for GitSource<'cfg> {
248
248
// exists.
249
249
exclude_from_backups_and_indexing ( & git_path) ;
250
250
251
- let db_path = git_path. join ( "db" ) . join ( & self . ident ) ;
251
+ let db_path = self . config . git_db_path ( ) . join ( & self . ident ) ;
252
+ let db_path = db_path. into_path_unlocked ( ) ;
252
253
253
254
let db = self . remote . db_at ( & db_path) . ok ( ) ;
254
255
let ( db, actual_rev) = match ( self . locked_rev , db) {
@@ -305,10 +306,12 @@ impl<'cfg> Source for GitSource<'cfg> {
305
306
// Check out `actual_rev` from the database to a scoped location on the
306
307
// filesystem. This will use hard links and such to ideally make the
307
308
// checkout operation here pretty fast.
308
- let checkout_path = git_path
309
- . join ( "checkouts" )
309
+ let checkout_path = self
310
+ . config
311
+ . git_checkouts_path ( )
310
312
. join ( & self . ident )
311
313
. join ( short_id. as_str ( ) ) ;
314
+ let checkout_path = checkout_path. into_path_unlocked ( ) ;
312
315
db. copy_to ( actual_rev, & checkout_path, self . config ) ?;
313
316
314
317
let source_id = self
Original file line number Diff line number Diff line change @@ -368,6 +368,18 @@ impl Config {
368
368
self . home_path . join ( "git" )
369
369
}
370
370
371
+ /// Gets the directory of code sources Cargo checkouts from Git bare repos
372
+ /// (`<cargo_home>/git/checkouts`).
373
+ pub fn git_checkouts_path ( & self ) -> Filesystem {
374
+ self . git_path ( ) . join ( "checkouts" )
375
+ }
376
+
377
+ /// Gets the directory for all Git bare repos Cargo clones
378
+ /// (`<cargo_home>/git/db`).
379
+ pub fn git_db_path ( & self ) -> Filesystem {
380
+ self . git_path ( ) . join ( "db" )
381
+ }
382
+
371
383
/// Gets the Cargo base directory for all registry information (`<cargo_home>/registry`).
372
384
pub fn registry_base_path ( & self ) -> Filesystem {
373
385
self . home_path . join ( "registry" )
You can’t perform that action at this time.
0 commit comments