Skip to content

Commit

Permalink
Increase timeout for clone command
Browse files Browse the repository at this point in the history
Some repositories take more than 2 minutes to download the first time.
  • Loading branch information
ktf committed Jun 20, 2024
1 parent c3c43bc commit 3d64945
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions alibuild_helpers/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
import os

GIT_COMMAND_TIMEOUT_SEC = 120
"""How many seconds to let any git command execute before being terminated."""
"""Default value for how many seconds to let any git command execute before being terminated."""

GIT_CMD_TIMEOUTS = {
"clone": 600,
}
"""Customised timeout for some commands."""

def clone_speedup_options():
"""Return a list of options supported by the system git which speed up cloning."""
Expand Down Expand Up @@ -93,7 +97,7 @@ def git(args, directory=".", check=True, prompt=True):
# GIT_TERMINAL_PROMPT is only supported in git 2.3+.
prompt_var=f"GIT_TERMINAL_PROMPT=0" if not prompt else "",
directory_safe_var=f"GIT_CONFIG_COUNT={lastGitOverride+2} GIT_CONFIG_KEY_{lastGitOverride}=safe.directory GIT_CONFIG_VALUE_{lastGitOverride}=$PWD GIT_CONFIG_KEY_{lastGitOverride+1}=gc.auto GIT_CONFIG_VALUE_{lastGitOverride+1}=0" if directory else "",
), timeout=GIT_COMMAND_TIMEOUT_SEC)
), timeout=GIT_CMD_TIMEOUTS.get(args[0] if len(args) else "*", GIT_COMMAND_TIMEOUT_SEC))
if check and err != 0:
raise SCMError("Error {} from git {}: {}".format(err, " ".join(args), output))
return output if check else (err, output)

0 comments on commit 3d64945

Please sign in to comment.