bump-cask-pr: fix duplicate PR checking with comma versions
This commit is contained in:
		
							parent
							
								
									8b2af53f32
								
							
						
					
					
						commit
						0aae1fa6ae
					
				@ -139,11 +139,7 @@ module Homebrew
 | 
			
		||||
      # For simplicity, our naming defers to the arm version if we multiple architectures are specified
 | 
			
		||||
      branch_version = new_version.arm || new_version.general
 | 
			
		||||
      if branch_version.is_a?(Cask::DSL::Version)
 | 
			
		||||
        commit_version = if branch_version.before_comma == cask.version.before_comma
 | 
			
		||||
          branch_version
 | 
			
		||||
        else
 | 
			
		||||
          branch_version.before_comma
 | 
			
		||||
        end
 | 
			
		||||
        commit_version = shortened_version(branch_version, cask: cask)
 | 
			
		||||
        branch_name = "bump-#{cask.token}-#{branch_version.tr(",:", "-")}"
 | 
			
		||||
        commit_message ||= "#{cask.token} #{commit_version}"
 | 
			
		||||
      end
 | 
			
		||||
@ -174,6 +170,15 @@ module Homebrew
 | 
			
		||||
    GitHub.create_bump_pr(pr_info, args: args)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig { params(version: Cask::DSL::Version, cask: Cask::Cask).returns(Cask::DSL::Version) }
 | 
			
		||||
  def shortened_version(version, cask:)
 | 
			
		||||
    if version.before_comma == cask.version.before_comma
 | 
			
		||||
      version
 | 
			
		||||
    else
 | 
			
		||||
      version.before_comma
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig {
 | 
			
		||||
    params(
 | 
			
		||||
      cask:              Cask::Cask,
 | 
			
		||||
@ -260,7 +265,7 @@ module Homebrew
 | 
			
		||||
        cask.token,
 | 
			
		||||
        tap_remote_repo,
 | 
			
		||||
        state:   "closed",
 | 
			
		||||
        version: version,
 | 
			
		||||
        version: shortened_version(version, cask: cask),
 | 
			
		||||
        file:    cask.sourcefile_path.relative_path_from(cask.tap.path).to_s,
 | 
			
		||||
        args:    args,
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user