Skip to content

Commit

Permalink
Prevent getting stuck on clone or pull
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastProject committed Aug 10, 2022
1 parent dd9d8b2 commit 2fc1350
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pext/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ def install(self, url: str, identifier: str, name: str, branch: bytes, verbose=F
Logger.log(None, Translation.get("downloading_from_url").format(name, url))

try:
porcelain.clone(UpdateManager.fix_git_url_for_dulwich(url), target=module_path, checkout=branch)
porcelain.clone(UpdateManager.fix_git_url_for_dulwich(url), target=module_path, checkout=branch, force=True)
except Exception as e:
if verbose:
Logger.log_critical(
Expand Down Expand Up @@ -1752,7 +1752,7 @@ def ensure_repo_branch(directory: str, branch: bytes) -> None:
# Update to wanted branch
remote_url = UpdateManager.fix_git_url_for_dulwich(UpdateManager.get_remote_url(directory))
try:
porcelain.pull(repo, remote_url, branch)
porcelain.pull(repo, remote_url, branch, force=True)
# Ensure a clean state on the wanted branch
repo.reset_index(repo[branch].tree)
repo.refs.set_symbolic_ref(b"HEAD", branch)
Expand Down Expand Up @@ -1791,7 +1791,7 @@ def update(directory: str) -> bool:

# Update
remote_url = UpdateManager.fix_git_url_for_dulwich(UpdateManager.get_remote_url(directory))
porcelain.pull(repo, remote_url)
porcelain.pull(repo, remote_url, force=True)

# See if anything was updated
return old_commit != repo[repo.head()]
Expand Down Expand Up @@ -2643,7 +2643,7 @@ def install(self, url: str, identifier: str, name: str, branch: bytes, verbose=F
Logger.log(None, Translation.get("downloading_from_url").format(name, url))

try:
porcelain.clone(UpdateManager.fix_git_url_for_dulwich(url), target=theme_path, checkout=branch)
porcelain.clone(UpdateManager.fix_git_url_for_dulwich(url), target=theme_path, checkout=branch, force=True)
except Exception as e:
if verbose:
Logger.log_critical(
Expand Down

0 comments on commit 2fc1350

Please sign in to comment.