mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
Umk: Git exe file path fix for windows builds. (#230)
This commit is contained in:
parent
7cedb84877
commit
5b1eecd275
4 changed files with 22 additions and 6 deletions
|
|
@ -554,13 +554,14 @@ Vector<String> RepoInfo(const String& package)
|
||||||
if(repo == GIT_DIR) {
|
if(repo == GIT_DIR) {
|
||||||
String h = GetCurrentDirectory();
|
String h = GetCurrentDirectory();
|
||||||
SetCurrentDirectory(d);
|
SetCurrentDirectory(d);
|
||||||
String v = HostSys("git rev-list --count HEAD");
|
String gitpath = GetGitPath();
|
||||||
|
String v = HostSys(gitpath + " rev-list --count HEAD");
|
||||||
if(IsDigit(*v))
|
if(IsDigit(*v))
|
||||||
info.Add("#define bmGIT_REVCOUNT " + AsCString(TrimBoth(v)));
|
info.Add("#define bmGIT_REVCOUNT " + AsCString(TrimBoth(v)));
|
||||||
v = HostSys("git rev-parse HEAD");
|
v = HostSys(gitpath + " rev-parse HEAD");
|
||||||
if(v.GetCount())
|
if(v.GetCount())
|
||||||
info.Add("#define bmGIT_HASH " + AsCString(TrimBoth(v)));
|
info.Add("#define bmGIT_HASH " + AsCString(TrimBoth(v)));
|
||||||
v = HostSys("git rev-parse --abbrev-ref HEAD");
|
v = HostSys(gitpath + " rev-parse --abbrev-ref HEAD");
|
||||||
if(v.GetCount())
|
if(v.GetCount())
|
||||||
info.Add("#define bmGIT_BRANCH " + AsCString(TrimBoth(v)));
|
info.Add("#define bmGIT_BRANCH " + AsCString(TrimBoth(v)));
|
||||||
SetCurrentDirectory(h);
|
SetCurrentDirectory(h);
|
||||||
|
|
|
||||||
|
|
@ -648,5 +648,6 @@ enum { NOT_REPO_DIR = 0, SVN_DIR, GIT_DIR };
|
||||||
|
|
||||||
int GetRepoKind(const String& p);
|
int GetRepoKind(const String& p);
|
||||||
int GetRepo(String& path);
|
int GetRepo(String& path);
|
||||||
|
String GetGitPath();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -25,3 +25,17 @@ int GetRepoKind(const String& p)
|
||||||
String pp = p;
|
String pp = p;
|
||||||
return GetRepo(pp);
|
return GetRepo(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String GetGitPath()
|
||||||
|
{
|
||||||
|
#ifdef PLATFORM_WIN32
|
||||||
|
static String path;
|
||||||
|
ONCELOCK {
|
||||||
|
path = AppendFileName(GetExeFolder(), "\\bin\\mingit\\cmd\\git.exe");
|
||||||
|
path = FileExists(path) ? "\"" + path + "\"" : "git";
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
#else
|
||||||
|
return "git";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ void UppHubDlg::Install(const Index<String>& ii_, bool update)
|
||||||
if(n) {
|
if(n) {
|
||||||
String dir = GetHubDir() + '/' + n->name;
|
String dir = GetHubDir() + '/' + n->name;
|
||||||
if(!DirectoryExists(dir)) {
|
if(!DirectoryExists(dir)) {
|
||||||
String cmd = "git clone ";
|
String cmd = GetGitPath() + " clone ";
|
||||||
if(n->branch.GetCount())
|
if(n->branch.GetCount())
|
||||||
cmd << "-b " + n->branch << ' ';
|
cmd << "-b " + n->branch << ' ';
|
||||||
cmd << n->repo;
|
cmd << n->repo;
|
||||||
|
|
@ -150,11 +150,11 @@ void UppHubDlg::Install(const Index<String>& ii_, bool update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (update) {
|
} else if (update) {
|
||||||
String cmd = "git -C ";
|
String cmd = GetGitPath() + " -C ";
|
||||||
cmd << dir << " clean -fxd";
|
cmd << dir << " clean -fxd";
|
||||||
PutConsole(cmd);
|
PutConsole(cmd);
|
||||||
system(cmd);
|
system(cmd);
|
||||||
cmd = "git -C ";
|
cmd = GetGitPath() + " -C ";
|
||||||
cmd << dir << " pull";
|
cmd << dir << " pull";
|
||||||
PutConsole(cmd);
|
PutConsole(cmd);
|
||||||
system(cmd);
|
system(cmd);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue