diff --git a/update_depot_tools b/update_depot_tools index d15ca563cc..93ce22ebfa 100755 --- a/update_depot_tools +++ b/update_depot_tools @@ -99,18 +99,20 @@ function update_git_repo { fi fi - # depot_tools.zip archives generated before 2021-03-12 have instruction to - # fetch only from old default git branch. Such branch won't be available - # evenutally, so fetch config needs to be updated. - git config --unset-all remote.origin.fetch - git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* - git fetch -q origin &> /dev/null - local CHECKOUT_TXT STATUS - CHECKOUT_TXT=$(git checkout -q origin/main 2>&1) + local GIT_CMD_TXT STATUS + GIT_CMD_TXT=$(git fetch -q origin main 2>&1) STATUS=$? if [[ $STATUS -ne 0 ]]; then - echo "depot_tools update failed. Conflict in $base_dir" >&2 - echo "$CHECKOUT_TXT" >&2 + echo "depot_tools update failed. Couldn't fetch main branch." + echo "Retry later or reclone depot_tools" >&2 + echo "$GIT_CMD_TXT" >&2 + else + GIT_CMD_TXT=$(git checkout -q origin/main 2>&1) + STATUS=$? + if [[ $STATUS -ne 0 ]]; then + echo "depot_tools update failed. Conflict in $base_dir" >&2 + echo "$GIT_CMD_TXT" >&2 + fi fi # Having python3 on depot_tools causes problems if users put depot_tools in # PATH before system's python3, so remove it if present.