@@ -554,18 +554,6 @@ impl<'cfg> RegistrySource<'cfg> {
554
554
Box :: new ( remote:: RemoteRegistry :: new ( source_id, config, & name) ) as Box < _ >
555
555
} ;
556
556
557
- // Before starting to work on the registry, make sure that
558
- // `<cargo_home>/registry` is marked as excluded from indexing and
559
- // backups. Older versions of Cargo didn't do this, so we do it here
560
- // regardless of whether `<cargo_home>` exists.
561
- //
562
- // This does not use `create_dir_all_excluded_from_backups_atomic` for
563
- // the same reason: we want to exclude it even if the directory already
564
- // exists.
565
- let registry_base = config. registry_base_path ( ) ;
566
- registry_base. create_dir ( ) ?;
567
- exclude_from_backups_and_indexing ( & registry_base. into_path_unlocked ( ) ) ?;
568
-
569
557
Ok ( RegistrySource :: new (
570
558
source_id,
571
559
config,
@@ -826,6 +814,18 @@ impl<'cfg> Source for RegistrySource<'cfg> {
826
814
}
827
815
828
816
fn block_until_ready ( & mut self ) -> CargoResult < ( ) > {
817
+ // Before starting to work on the registry, make sure that
818
+ // `<cargo_home>/registry` is marked as excluded from indexing and
819
+ // backups. Older versions of Cargo didn't do this, so we do it here
820
+ // regardless of whether `<cargo_home>` exists.
821
+ //
822
+ // This does not use `create_dir_all_excluded_from_backups_atomic` for
823
+ // the same reason: we want to exclude it even if the directory already
824
+ // exists.
825
+ let registry_base = self . config . registry_base_path ( ) ;
826
+ registry_base. create_dir ( ) ?;
827
+ exclude_from_backups_and_indexing ( & registry_base. into_path_unlocked ( ) ) ?;
828
+
829
829
self . ops . block_until_ready ( )
830
830
}
831
831
}
0 commit comments