diff --git a/uppsrc/ide/Builders/CppBuilder.cpp b/uppsrc/ide/Builders/CppBuilder.cpp index 583a36e3a..ad5287f86 100644 --- a/uppsrc/ide/Builders/CppBuilder.cpp +++ b/uppsrc/ide/Builders/CppBuilder.cpp @@ -554,13 +554,14 @@ Vector RepoInfo(const String& package) if(repo == GIT_DIR) { String h = GetCurrentDirectory(); SetCurrentDirectory(d); - String v = HostSys("git rev-list --count HEAD"); + String gitpath = GetGitPath(); + String v = HostSys(gitpath + " rev-list --count HEAD"); if(IsDigit(*v)) info.Add("#define bmGIT_REVCOUNT " + AsCString(TrimBoth(v))); - v = HostSys("git rev-parse HEAD"); + v = HostSys(gitpath + " rev-parse HEAD"); if(v.GetCount()) 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()) info.Add("#define bmGIT_BRANCH " + AsCString(TrimBoth(v))); SetCurrentDirectory(h); diff --git a/uppsrc/ide/Core/Core.h b/uppsrc/ide/Core/Core.h index 805f8a34e..3a7372489 100644 --- a/uppsrc/ide/Core/Core.h +++ b/uppsrc/ide/Core/Core.h @@ -648,5 +648,6 @@ enum { NOT_REPO_DIR = 0, SVN_DIR, GIT_DIR }; int GetRepoKind(const String& p); int GetRepo(String& path); +String GetGitPath(); #endif \ No newline at end of file diff --git a/uppsrc/ide/Core/Util.cpp b/uppsrc/ide/Core/Util.cpp index 748760f22..f6db05a5c 100644 --- a/uppsrc/ide/Core/Util.cpp +++ b/uppsrc/ide/Core/Util.cpp @@ -25,3 +25,17 @@ int GetRepoKind(const String& p) String pp = p; 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 +} diff --git a/uppsrc/umk/UppHub.cpp b/uppsrc/umk/UppHub.cpp index b252c56b2..650d3290e 100644 --- a/uppsrc/umk/UppHub.cpp +++ b/uppsrc/umk/UppHub.cpp @@ -131,7 +131,7 @@ void UppHubDlg::Install(const Index& ii_, bool update) if(n) { String dir = GetHubDir() + '/' + n->name; if(!DirectoryExists(dir)) { - String cmd = "git clone "; + String cmd = GetGitPath() + " clone "; if(n->branch.GetCount()) cmd << "-b " + n->branch << ' '; cmd << n->repo; @@ -150,11 +150,11 @@ void UppHubDlg::Install(const Index& ii_, bool update) } } } else if (update) { - String cmd = "git -C "; + String cmd = GetGitPath() + " -C "; cmd << dir << " clean -fxd"; PutConsole(cmd); system(cmd); - cmd = "git -C "; + cmd = GetGitPath() + " -C "; cmd << dir << " pull"; PutConsole(cmd); system(cmd);