Skip to content

Commit

Permalink
Merge pull request #109 from BrianPugh/fix-git-branch
Browse files Browse the repository at this point in the history
fix git checking out branch/commits
  • Loading branch information
BrianPugh authored Feb 18, 2023
2 parents c558220 + 3370f48 commit dc9a0f4
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 dc9a0f4

Please sign in to comment.