Merge pull request #656 from shuffle2/find-git-ext

Windows: Also look for git.exe in the registry (for Git Extensions installs).
This commit is contained in:
Pierre Bourdon 2014-07-20 22:02:51 +02:00
commit 4f78ba6a76

View File

@ -8,6 +8,15 @@ var cmd_branch = " rev-parse --abbrev-ref HEAD";
function GetGitExe() function GetGitExe()
{ {
try
{
gitexe = wshShell.RegRead("HKCU\\Software\\GitExtensions\\gitcommand");
wshShell.Exec(gitexe);
return gitexe;
}
catch (e)
{}
for (var gitexe in {"git.cmd":1, "git":1, "git.bat":1}) for (var gitexe in {"git.cmd":1, "git":1, "git.bat":1})
{ {
try try
@ -56,7 +65,7 @@ var gitexe = GetGitExe();
var revision = GetFirstStdOutLine(gitexe + cmd_revision); var revision = GetFirstStdOutLine(gitexe + cmd_revision);
var describe = GetFirstStdOutLine(gitexe + cmd_describe); var describe = GetFirstStdOutLine(gitexe + cmd_describe);
var branch = GetFirstStdOutLine(gitexe + cmd_branch); var branch = GetFirstStdOutLine(gitexe + cmd_branch);
var isMaster = +("master" == branch); var isMaster = +("master" == branch);
// remove hash (and trailing "-0" if needed) from description // remove hash (and trailing "-0" if needed) from description
describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2'); describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2');