Skip to content

Commit

Permalink
GitSCM.update_repo: use git fetch rather than pull
Browse files Browse the repository at this point in the history
  • Loading branch information
shtrom committed Jan 10, 2025
1 parent 8375fc2 commit 2588f72
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/lando/main/scm/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,17 @@ def update_repo(self, pull_path: str, target_cset: Optional[str] = None) -> str:
"""
branch = target_cset or self.default_branch
self.clean_repo()
self._git_run("pull", "--prune", pull_path, cwd=self.path)
self._git_run("checkout", "--force", "-B", branch, cwd=self.path)
# Fetch all refs at the given pull_path, and overwrite the `origin` references.
self._git_run(
"fetch",
"--prune",
pull_path,
"+refs/heads/*:refs/remotes/origin/*",
cwd=self.path,
)
self._git_run(
"checkout", "--force", "-B", branch, f"origin/{branch}", cwd=self.path
)
return self.head_ref()

def clean_repo(self, *, strip_non_public_commits: bool = True):
Expand Down

0 comments on commit 2588f72

Please sign in to comment.