Merge pull request #20190 from Homebrew/local-main-fix
cmd/update: ensure local branch moves to main
This commit is contained in:
		
						commit
						01c8e42ea8
					
				@ -252,13 +252,12 @@ EOS
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  INITIAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
 | 
					  INITIAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
 | 
				
			||||||
  SOFT_DELETE_MASTER=
 | 
					  MAIN_MIGRATION_REQUIRED=
 | 
				
			||||||
  if [[ "${INITIAL_BRANCH}" == "master" &&
 | 
					  if [[ "${INITIAL_BRANCH}" == "master" &&
 | 
				
			||||||
        ("${DIR}" == "${HOMEBREW_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CASK_REPOSITORY}") ]]
 | 
					        ("${DIR}" == "${HOMEBREW_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CASK_REPOSITORY}") ]]
 | 
				
			||||||
  then
 | 
					  then
 | 
				
			||||||
    # Migrate master to main for Homebrew/brew, homebrew-core or homebrew-cask
 | 
					    # Migrate master to main for Homebrew/brew, homebrew-core or homebrew-cask
 | 
				
			||||||
    INITIAL_BRANCH="main"
 | 
					    MAIN_MIGRATION_REQUIRED="1"
 | 
				
			||||||
    SOFT_DELETE_MASTER="1"
 | 
					 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ -n "${UPSTREAM_TAG}" ]] ||
 | 
					  if [[ -n "${UPSTREAM_TAG}" ]] ||
 | 
				
			||||||
@ -326,7 +325,7 @@ EOS
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if [[ -n "${HOMEBREW_NO_UPDATE_CLEANUP}" ]]
 | 
					  if [[ -n "${HOMEBREW_NO_UPDATE_CLEANUP}" ]]
 | 
				
			||||||
  then
 | 
					  then
 | 
				
			||||||
    if [[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" ]] &&
 | 
					    if [[ -z "${MAIN_MIGRATION_REQUIRED}" && "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" ]] &&
 | 
				
			||||||
       [[ ! "${INITIAL_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]]
 | 
					       [[ ! "${INITIAL_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]]
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
      git checkout "${INITIAL_BRANCH}" "${QUIET_ARGS[@]}"
 | 
					      git checkout "${INITIAL_BRANCH}" "${QUIET_ARGS[@]}"
 | 
				
			||||||
@ -337,7 +336,7 @@ EOS
 | 
				
			|||||||
    pop_stash_message
 | 
					    pop_stash_message
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ "${SOFT_DELETE_MASTER}" == 1 && -n "$(git config branch.main.remote 2>/dev/null || true)" ]]
 | 
					  if [[ -n "${MAIN_MIGRATION_REQUIRED}" && -n "$(git config branch.main.remote 2>/dev/null || true)" ]]
 | 
				
			||||||
  then
 | 
					  then
 | 
				
			||||||
    git branch -d "${QUIET_ARGS[@]}" master
 | 
					    git branch -d "${QUIET_ARGS[@]}" master
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user