Skip to content

Commit 19b6817

Browse files
committed
fix(run-task)!: stop fetching / checking out 'base_ref'
BREAKING CHANGE: `base_ref` will no longer be fetched or checked out by run-task Taskgraph uses base_rev anyway for computing files changed, so there's no need to additionally fetch base_ref. Some tasks may need to be updated to not rely on base_ref being present in the local clone.
1 parent 8acc55f commit 19b6817

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

src/taskgraph/run-task/run-task

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,6 @@ def git_checkout(
594594
destination_path: str,
595595
head_repo: str,
596596
base_repo: Optional[str],
597-
base_ref: Optional[str],
598597
base_rev: Optional[str],
599598
ref: Optional[str],
600599
commit: Optional[str],
@@ -642,29 +641,14 @@ def git_checkout(
642641

643642
retry_required_command(b"vcs", args, extra_env=env)
644643

645-
if base_ref:
646-
args = ["git", "fetch", "origin", base_ref]
647-
648-
retry_required_command(b"vcs", args, cwd=destination_path, extra_env=env)
649-
650-
# Create local branch so that taskgraph is able to compute differences
651-
# between the head branch and the base one, if needed
652-
args = ["git", "checkout", base_ref]
653-
654-
retry_required_command(b"vcs", args, cwd=destination_path, extra_env=env)
655-
656-
# When commits are force-pushed (like on a testing branch), base_rev doesn't
657-
# exist on base_ref. Fetching it allows taskgraph to compute differences
658-
# between the previous state before the force-push and the current state.
659-
#
660-
# Unlike base_ref just above, there is no need to checkout the revision:
661-
# it's immediately available after the fetch.
644+
# Fetching base_rev allows Taskgraph to compute the files changed by the
645+
# push.
662646
if base_rev and base_rev != NULL_REVISION:
663647
args = ["git", "fetch", "origin", base_rev]
664648

665649
retry_required_command(b"vcs", args, cwd=destination_path, extra_env=env)
666650

667-
# Fetch ref
651+
# Fetch head ref
668652
args = ["git", "fetch"]
669653
if ref and base_repo == head_repo:
670654
# If a ref was provided, it might be tag, so we need to make sure we fetch
@@ -878,7 +862,6 @@ def collect_vcs_options(args, project, name):
878862

879863
repo_type = os.environ.get("%s_REPOSITORY_TYPE" % env_prefix)
880864
base_repo = os.environ.get("%s_BASE_REPOSITORY" % env_prefix)
881-
base_ref = os.environ.get("%s_BASE_REF" % env_prefix)
882865
base_rev = os.environ.get("%s_BASE_REV" % env_prefix)
883866
head_repo = os.environ.get("%s_HEAD_REPOSITORY" % env_prefix)
884867
revision = os.environ.get("%s_HEAD_REV" % env_prefix)
@@ -911,7 +894,6 @@ def collect_vcs_options(args, project, name):
911894
"checkout": checkout,
912895
"sparse-profile": sparse_profile,
913896
"base-repo": base_repo,
914-
"base-ref": base_ref,
915897
"base-rev": base_rev,
916898
"head-repo": head_repo,
917899
"revision": revision,

0 commit comments

Comments
 (0)