mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
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/+/3389824 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user