4646 attached : DashSet < encoding:: Digest > ,
4747 dry_run : bool ,
4848 must_be_older_than : DateTime < Utc > ,
49+ prune_all_tag_namespaces : bool ,
4950 prune_repeated_tags : Option < NonZero < u64 > > ,
5051 prune_params : PruneParameters ,
5152 remove_proxies_with_no_links : bool ,
@@ -69,6 +70,7 @@ impl<'repo> Cleaner<'repo, SilentCleanReporter> {
6970 attached : Default :: default ( ) ,
7071 dry_run : false ,
7172 must_be_older_than : Utc :: now ( ) ,
73+ prune_all_tag_namespaces : false ,
7274 prune_repeated_tags : None ,
7375 prune_params : Default :: default ( ) ,
7476 remove_proxies_with_no_links : true ,
8991 attached : self . attached ,
9092 dry_run : self . dry_run ,
9193 must_be_older_than : self . must_be_older_than ,
94+ prune_all_tag_namespaces : self . prune_all_tag_namespaces ,
9295 prune_repeated_tags : self . prune_repeated_tags ,
9396 prune_params : self . prune_params ,
9497 removal_concurrency : self . removal_concurrency ,
@@ -155,6 +158,13 @@ where
155158 self
156159 }
157160
161+ /// When walking tags, whether to prune tags in all tag namespaces or only
162+ /// the tag namespace configured on the repository.
163+ pub fn with_prune_all_tag_namespaces ( mut self , prune_all_tag_namespaces : bool ) -> Self {
164+ self . prune_all_tag_namespaces = prune_all_tag_namespaces;
165+ self
166+ }
167+
158168 /// When walking the history of a tag, delete older entries
159169 /// that have the same target as a more recent one.
160170 pub fn with_prune_repeated_tags ( mut self , prune_repeated_tags : Option < NonZero < u64 > > ) -> Self {
@@ -428,14 +438,15 @@ where
428438 // still alive, but if the repo passed to the Cleaner has a namespace
429439 // set on it then one would expect that only tags in that namespace are
430440 // pruned.
431- let should_prune_this_namespace = match (
432- tag_namespace_to_prune. as_ref ( ) ,
433- tag_namespace_to_visit. as_deref ( ) ,
434- ) {
435- ( Some ( prune) , Some ( visit) ) if prune. as_ref ( ) == visit => true ,
436- ( None , None ) => true ,
437- _ => false ,
438- } ;
441+ let should_prune_this_namespace = self . prune_all_tag_namespaces
442+ || match (
443+ tag_namespace_to_prune. as_ref ( ) ,
444+ tag_namespace_to_visit. as_deref ( ) ,
445+ ) {
446+ ( Some ( prune) , Some ( visit) ) if prune. as_ref ( ) == visit => true ,
447+ ( None , None ) => true ,
448+ _ => false ,
449+ } ;
439450
440451 let history = self
441452 . repo
0 commit comments