Revert "fix(steps/git): use force-fetch refspec so force-pushed branches are picked up"

This reverts commit 53b8796319.
This commit is contained in:
hermes
2026-09-18 21:48:09 +00:00
parent 53b8796319
commit 0bb705fc3e
+1 -5
View File
@@ -103,17 +103,13 @@ class GitClone(AbstractStep[str]):
remote.set_url(auth_url)
else:
remote = repo.create_remote(remote_name, auth_url)
force_refspec = f"+refs/heads/*:refs/remotes/{remote_name}/*"
existing_refspecs = list(remote.refspec)
if force_refspec not in existing_refspecs:
remote.set_refspec(remote.refspec + (force_refspec,))
if remote_name == "origin" and self.branchNamePrefix != "":
with repo.config_writer() as config:
config.set_value('remote "origin"', "fetch",
f"+refs/heads/{self.branchNamePrefix}/*:refs/remotes/origin/{self.branchNamePrefix}/*")
result = remote.fetch(prune=True)
if not result or any(fetch_info.flags & fetch_info.ERROR for fetch_info in result):
raise BaseException(f"Failed to fetch updates for {remote_name}")
raise BaseException(f"Failed to fetch updates for {repository_url}")
if not os.path.exists(os.path.join(self.repo_path, ".git")):
raise BaseException(f"Failed to clone repositories {self.remotes} to {self.repo_path}")
except BaseException as e: