Commit 5bdfcd8f authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

Add `main` when guessing origin remote

This fixes presubmit checks that rely on FetchUpstreamTuple which is
used in patching.

R=ehmaldonado@chromium.org

Bug: 1143724
Change-Id: I163fa0ea6f1b356280d497196869bb206463ad4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2515268
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent 655afebf
......@@ -226,7 +226,11 @@ class GIT(object):
return remote, upstream_branch
# Else, try to guess the origin remote.
if 'origin/master' in GIT.GetRemoteBranches(cwd):
remote_branches = GIT.GetRemoteBranches(cwd)
if 'origin/main' in remote_branches:
# Fall back on origin/main if it exits.
return 'origin', 'refs/heads/main'
elif 'origin/master' in remote_branches:
# Fall back on origin/master if it exits.
return 'origin', 'refs/heads/master'
......
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