blob: c4fd3b2aeab0aa81c1d1010a28255a057f160c3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <cstring>
#include "fetch_git.hh"
#include "vars.hh"
int fetch_git(Pkg pkg) {
std::string clone_cmds[] = {
"git -c advice.detachedHead=false clone " + pkg.url +
" " + pkg.src.c_str(),
"git -c advice.detachedHead=false clone --branch " + pkg.ver +
" " + pkg.url + " " + pkg.src.c_str()
};
if (strcmp(pkg.ver.c_str(), "HEAD") == 0) {
if (system(clone_cmds[0].c_str()) != 0) { system(clone_cmds[0].c_str()); }
} else {
if (system(clone_cmds[2].c_str()) != 0) { system(clone_cmds[1].c_str()); }
}
return 0;
}
|