cmd/update: ensure we update remote main ref
This commit is contained in:
		
							parent
							
								
									c9d3df2e54
								
							
						
					
					
						commit
						7f3f3c2d55
					
				@ -252,6 +252,7 @@ EOS
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  INITIAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
 | 
			
		||||
  SOFT_DELETE_MASTER=
 | 
			
		||||
  if [[ "${INITIAL_BRANCH}" == "master" &&
 | 
			
		||||
        ("${DIR}" == "${HOMEBREW_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CASK_REPOSITORY}") ]]
 | 
			
		||||
  then
 | 
			
		||||
@ -682,6 +683,16 @@ EOS
 | 
			
		||||
        UPSTREAM_REPOSITORY_TOKEN="${BASH_REMATCH[1]#*:}"
 | 
			
		||||
      fi
 | 
			
		||||
 | 
			
		||||
      MAIN_MIGRATION_REQUIRED=
 | 
			
		||||
      if [[ "${UPSTREAM_BRANCH_DIR}" == "master" &&
 | 
			
		||||
            ("${DIR}" == "${HOMEBREW_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CASK_REPOSITORY}") ]]
 | 
			
		||||
      then
 | 
			
		||||
        # Migrate master to main for Homebrew/brew, homebrew-core or homebrew-cask
 | 
			
		||||
        MAIN_MIGRATION_REQUIRED=1
 | 
			
		||||
        UPSTREAM_BRANCH_DIR="main"
 | 
			
		||||
        declare UPSTREAM_BRANCH"${TAP_VAR}"="main"
 | 
			
		||||
      fi
 | 
			
		||||
 | 
			
		||||
      if [[ -n "${UPSTREAM_REPOSITORY}" ]]
 | 
			
		||||
      then
 | 
			
		||||
        # UPSTREAM_REPOSITORY_TOKEN is parsed (if exists) from UPSTREAM_REPOSITORY_URL
 | 
			
		||||
@ -793,6 +804,11 @@ EOS
 | 
			
		||||
        fi
 | 
			
		||||
      fi
 | 
			
		||||
 | 
			
		||||
      if [[ -n "${MAIN_MIGRATION_REQUIRED}" ]]
 | 
			
		||||
      then
 | 
			
		||||
        git remote set-head origin --auto >/dev/null
 | 
			
		||||
      fi
 | 
			
		||||
 | 
			
		||||
      rm -f "${tmp_failure_file}"
 | 
			
		||||
    ) &
 | 
			
		||||
  done
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user