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