@@ -609,7 +609,6 @@ def git_checkout(
609609 destination_path : str ,
610610 head_repo : str ,
611611 base_repo : Optional [str ],
612- base_ref : Optional [str ],
613612 base_rev : Optional [str ],
614613 head_ref : Optional [str ],
615614 head_rev : Optional [str ],
@@ -664,23 +663,11 @@ def git_checkout(
664663
665664 retry_required_command (b"vcs" , args , extra_env = env )
666665
667- if base_ref :
668- args = ["git" , "fetch" , "origin" , base_ref ]
669-
670- retry_required_command (b"vcs" , args , cwd = destination_path , extra_env = env )
671-
672- # Create local branch so that taskgraph is able to compute differences
673- # between the head branch and the base one, if needed
674- args = ["git" , "checkout" , base_ref ]
675-
676- retry_required_command (b"vcs" , args , cwd = destination_path , extra_env = env )
677-
678- # When commits are force-pushed (like on a testing branch), base_rev doesn't
679- # exist on base_ref. Fetching it allows taskgraph to compute differences
680- # between the previous state before the force-push and the current state.
681- #
682- # Unlike base_ref just above, there is no need to checkout the revision:
683- # it's immediately available after the fetch.
666+ # For Github based repos, base_rev often doesn't refer to an ancestor of
667+ # head_rev simply due to Github not providing that information in their
668+ # webhook events. Therefore we fetch it independently from `head_rev` so
669+ # that consumers can compute the merge-base or files modified between the
670+ # two as needed.
684671 if base_rev and base_rev != NULL_REVISION :
685672 args = ["git" , "fetch" , "origin" , base_rev ]
686673
@@ -900,7 +887,6 @@ def collect_vcs_options(args, project, name):
900887
901888 repo_type = os .environ .get (f"{ env_prefix } _REPOSITORY_TYPE" )
902889 base_repo = os .environ .get (f"{ env_prefix } _BASE_REPOSITORY" )
903- base_ref = os .environ .get (f"{ env_prefix } _BASE_REF" )
904890 base_rev = os .environ .get (f"{ env_prefix } _BASE_REV" )
905891 head_repo = os .environ .get (f"{ env_prefix } _HEAD_REPOSITORY" )
906892 head_ref = os .environ .get (f"{ env_prefix } _HEAD_REF" )
@@ -933,7 +919,6 @@ def collect_vcs_options(args, project, name):
933919 "checkout" : checkout ,
934920 "sparse-profile" : sparse_profile ,
935921 "base-repo" : base_repo ,
936- "base-ref" : base_ref ,
937922 "base-rev" : base_rev ,
938923 "head-repo" : head_repo ,
939924 "head-ref" : head_ref ,
@@ -984,7 +969,6 @@ def vcs_checkout_from_args(options):
984969 options ["checkout" ],
985970 options ["head-repo" ],
986971 options ["base-repo" ],
987- options ["base-ref" ],
988972 options ["base-rev" ],
989973 head_ref ,
990974 head_rev ,
0 commit comments