Revert "Use HEAD instead of hardcoded branch"

This reverts commit 6651fd8847.

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/+/2597065
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
changes/65/2597065/4
Josip Sokcevic 4 years ago committed by LUCI CQ
parent 81098e59ad
commit 7e73512268

@ -534,7 +534,7 @@ upload.
Args: Args:
* branch (str): new branch name, which must not yet exist. * branch (str): new branch name, which must not yet exist.
* name (str): step name. * name (str): step name.
* upstream (str): to origin/main. * upstream (str): to origin/master.
* kwargs: Forwarded to '__call__'. * kwargs: Forwarded to '__call__'.
&mdash; **def [rebase](/recipes/recipe_modules/git/api.py#328)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):** &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: # There are five kinds of refs we can be handed:
# 0) None. In this case, we default to api.buildbucket.gitiles_commit.ref. # 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). # Chop off 'refs/heads/' and now it matches case (4).
# 2) A 40-character SHA1 hash. # 2) A 40-character SHA1 hash.
# 3) A fully-qualifed arbitrary ref, e.g. 'refs/foo/bar/baz'. # 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 # 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 # checkout target) if many refs are fetched, but we only explicitly fetch
# one ref here, so this is safe. # one ref here, so this is safe.
if not ref: # Case 0. 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 it's a fully-qualified branch name, trim the 'refs/heads/' prefix.
if ref.startswith('refs/heads/'): # Case 1. if ref.startswith('refs/heads/'): # Case 1.
@ -396,7 +396,7 @@ class GitApi(recipe_api.RecipeApi):
Args: Args:
* branch (str): new branch name, which must not yet exist. * branch (str): new branch name, which must not yet exist.
* name (str): step name. * name (str): step name.
* upstream (str): to origin/main. * upstream (str): to origin/master.
* kwargs: Forwarded to '__call__'. * kwargs: Forwarded to '__call__'.
""" """
env = self.m.context.env env = self.m.context.env

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress", "--progress",
"--tags" "--tags"

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -37,7 +37,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -64,7 +64,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -18,7 +18,7 @@
"git", "git",
"fetch", "fetch",
"not_origin", "not_origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

@ -16,7 +16,7 @@
"git", "git",
"fetch", "fetch",
"origin", "origin",
"HEAD", "master",
"--recurse-submodules", "--recurse-submodules",
"--progress" "--progress"
], ],

Loading…
Cancel
Save