From 34f6a30d2087d6818dcc5958de5f1d2b7c773210 Mon Sep 17 00:00:00 2001 From: topilski Date: Sat, 10 Feb 2018 05:43:58 +0300 Subject: [PATCH] git clone branch --- base/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/base/utils.py b/base/utils.py index eb0e907..e2d1b11 100644 --- a/base/utils.py +++ b/base/utils.py @@ -164,8 +164,11 @@ def build_from_sources(url, compiler_flags: CompileInfo, source_dir_path, prefix shutil.rmtree(extracted_folder) -def git_clone(url: str, current_dir: str, remove_dot_git=True): - common_git_clone_line = ['git', 'clone', '--depth=1', url] +def git_clone(url: str, current_dir: str, branch=None, remove_dot_git=True): + if branch: + common_git_clone_line = ['git', 'clone', '--branch', branch, '--single-branch', url] + else: + common_git_clone_line = ['git', 'clone', '--depth=1', url] cloned_dir = os.path.splitext(url.rsplit('/', 1)[-1])[0] common_git_clone_line.append(cloned_dir) subprocess.call(common_git_clone_line)