From 16ae8338d9227ba9b06694c199e7aedec11d4ef5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 10 Feb 2018 22:47:57 +0100 Subject: GitRepository: clone using specified branch --- src/GitRepository.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/GitRepository.cpp') diff --git a/src/GitRepository.cpp b/src/GitRepository.cpp index 0a3b0a7..7818bdb 100644 --- a/src/GitRepository.cpp +++ b/src/GitRepository.cpp @@ -35,9 +35,12 @@ namespace sibs Result GitRepository::clone(GitDependency *gitDependency, const FileString &repoDirPath) { + // TODO: Use git dependency revision when cloning gitInit(); git_repository *repo; - int error = git_clone(&repo, gitDependency->url.c_str(), toUtf8(repoDirPath).c_str(), NULL); + git_clone_options options = GIT_CLONE_OPTIONS_INIT; + options.checkout_branch = gitDependency->branch.c_str(); + int error = git_clone(&repo, gitDependency->url.c_str(), toUtf8(repoDirPath).c_str(), &options); if(error != 0) return buildGitError(error, "Failed to clone git repository"); -- cgit v1.2.3