Skip to content

Commit

Permalink
fix git checking out branch/commits
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianPugh committed Feb 18, 2023
1 parent c558220 commit 3370f48
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions belay/packagemanager/downloaders/_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@ def github(dst: Path, uri: str):
if (repo_folder / ".git").is_dir():
# Already been cloned
repo = git.Repo(repo_folder)
origin = repo.remote("origin")
origin.fetch()
repo.remotes.origin.pull()
else:
repo = git.Repo.clone_from(repo_url, repo_folder)

# Set to specified reference
commit = repo.rev_parse(ref)
repo.head.reference = commit
repo.head.reset(index=True, working_tree=True)
repo.git.clean("-xdf")
repo.git.checkout(ref)

shutil.copytree(repo_folder / path, dst, dirs_exist_ok=True)
else:
Expand Down

0 comments on commit 3370f48

Please sign in to comment.