Commit 7e735122 authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

Revert "Use HEAD instead of hardcoded branch"

This reverts commit 6651fd88.

Reason for revert: broke some cros builds (check original CL for
discussion)

Original change's description:
> Use HEAD instead of hardcoded branch
>
> Repositories may have different default branches. This ensures to fetch
> remote HEAD branch which is default branch. Only downside to this
> approach is that actual branch (e.g. origin/main) reference won't be
> updated. Since we don't need it for this particular case, it should be
> fine to use HEAD.
>
> R=​apolito@google.com, ehmaldonaldo@chromium.org
>
> Bug: 1155492
> Recipe-Nontrivial-Roll: chromiumos
> Recipe-Nontrivial-Roll: infra
> Recipe-Nontrivial-Roll: build_limited_scripts_slave
> Change-Id: Ib2e6e50901a0a10ed647acea3aeb517b83567702
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2580190
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

TBR=ehmaldonado@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1155492
Recipe-Nontrivial-Roll: chromiumos
Recipe-Nontrivial-Roll: infra
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Recipe-Nontrivial-Roll: build
Change-Id: Ibd9f67bea71ee4a644b1077a365dbcd2a2c469f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2597065Reviewed-by: 's avatarAnthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
parent 81098e59
......@@ -534,7 +534,7 @@ upload.
Args:
* branch (str): new branch name, which must not yet exist.
* name (str): step name.
* upstream (str): to origin/main.
* upstream (str): to origin/master.
* kwargs: Forwarded to '__call__'.
&mdash; **def [rebase](/recipes/recipe_modules/git/api.py#328)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):**
......
......@@ -211,16 +211,16 @@ class GitApi(recipe_api.RecipeApi):
# There are five kinds of refs we can be handed:
# 0) None. In this case, we default to api.buildbucket.gitiles_commit.ref.
# 1) A fully qualified branch name, e.g. 'refs/heads/main'.
# 1) A fully qualified branch name, e.g. 'refs/heads/master'.
# Chop off 'refs/heads/' and now it matches case (4).
# 2) A 40-character SHA1 hash.
# 3) A fully-qualifed arbitrary ref, e.g. 'refs/foo/bar/baz'.
# 4) A branch name, e.g. 'main'.
# 4) A branch name, e.g. 'master'.
# Note that 'FETCH_HEAD' can be many things (and therefore not a valid
# checkout target) if many refs are fetched, but we only explicitly fetch
# one ref here, so this is safe.
if not ref: # Case 0.
ref = self.m.buildbucket.gitiles_commit.ref or 'HEAD'
ref = self.m.buildbucket.gitiles_commit.ref or 'master'
# If it's a fully-qualified branch name, trim the 'refs/heads/' prefix.
if ref.startswith('refs/heads/'): # Case 1.
......@@ -396,7 +396,7 @@ class GitApi(recipe_api.RecipeApi):
Args:
* branch (str): new branch name, which must not yet exist.
* name (str): step name.
* upstream (str): to origin/main.
* upstream (str): to origin/master.
* kwargs: Forwarded to '__call__'.
"""
env = self.m.context.env
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress",
"--tags"
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -37,7 +37,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -64,7 +64,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -18,7 +18,7 @@
"git",
"fetch",
"not_origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
......@@ -16,7 +16,7 @@
"git",
"fetch",
"origin",
"HEAD",
"master",
"--recurse-submodules",
"--progress"
],
......
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