Skip to content

Commit 423a55a

Browse files
authored
Increase timeout for clone command (#852)
1 parent 2a473d2 commit 423a55a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: alibuild_helpers/git.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
import os
66

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

10+
GIT_CMD_TIMEOUTS = {
11+
"clone": 600,
12+
"checkout": 600
13+
}
14+
"""Customised timeout for some commands."""
1015

1116
def clone_speedup_options():
1217
"""Return a list of options supported by the system git which speed up cloning."""
@@ -93,7 +98,7 @@ def git(args, directory=".", check=True, prompt=True):
9398
# GIT_TERMINAL_PROMPT is only supported in git 2.3+.
9499
prompt_var=f"GIT_TERMINAL_PROMPT=0" if not prompt else "",
95100
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 "",
96-
), timeout=GIT_COMMAND_TIMEOUT_SEC)
101+
), timeout=GIT_CMD_TIMEOUTS.get(args[0] if len(args) else "*", GIT_COMMAND_TIMEOUT_SEC))
97102
if check and err != 0:
98103
raise SCMError("Error {} from git {}: {}".format(err, " ".join(args), output))
99104
return output if check else (err, output)

0 commit comments

Comments
 (0)