autoremove: skip formulae where installed_on_request is nil
This commit is contained in:
		
							parent
							
								
									a40f32776f
								
							
						
					
					
						commit
						e28d455154
					
				@ -107,6 +107,13 @@ RSpec.describe Utils::Autoremove do
 | 
				
			|||||||
      expect(described_class.send(:unused_formulae_with_no_formula_dependents, formulae))
 | 
					      expect(described_class.send(:unused_formulae_with_no_formula_dependents, formulae))
 | 
				
			||||||
        .to match_array(formulae)
 | 
					        .to match_array(formulae)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    specify "installed on request is null" do
 | 
				
			||||||
 | 
					      allow(tab_from_keg).to receive(:installed_on_request).and_return(nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      expect(described_class.send(:unused_formulae_with_no_formula_dependents, formulae))
 | 
				
			||||||
 | 
					        .to eq([])
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  shared_context "with formulae and casks for dependency testing" do
 | 
					  shared_context "with formulae and casks for dependency testing" do
 | 
				
			||||||
 | 
				
			|||||||
@ -61,8 +61,8 @@ module Utils
 | 
				
			|||||||
      # @private
 | 
					      # @private
 | 
				
			||||||
      sig { params(formulae: T::Array[Formula]).returns(T::Array[Formula]) }
 | 
					      sig { params(formulae: T::Array[Formula]).returns(T::Array[Formula]) }
 | 
				
			||||||
      def unused_formulae_with_no_formula_dependents(formulae)
 | 
					      def unused_formulae_with_no_formula_dependents(formulae)
 | 
				
			||||||
        unused_formulae = bottled_formulae_with_no_formula_dependents(formulae).reject do |f|
 | 
					        unused_formulae = bottled_formulae_with_no_formula_dependents(formulae).select do |f|
 | 
				
			||||||
          f.any_installed_keg&.tab&.installed_on_request
 | 
					          f.any_installed_keg&.tab&.installed_on_request == false
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        unless unused_formulae.empty?
 | 
					        unless unused_formulae.empty?
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user