Commit b674278c authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

Always fetch main in update_depot_tools

If main is not fetchable, report the error to end user.

R=gavinmak@google.com

Bug: 1277136
Change-Id: I8c061719f9aadc42786045b3c5331bab3d0caae7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3389824Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
parent 237cc469
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment