tools: check if git can be called (is in path) before calling it

git-svn-id: trunk@37473 -
This commit is contained in:
blikblum 2012-06-01 23:54:32 +00:00
parent 3bcf717da9
commit fa0f36b694

View File

@ -89,6 +89,25 @@ var
const
RevisionIncComment = '// Created by Svn2RevisionInc';
function GitInPath: Boolean;
var
P: TProcessUTF8;
begin
Result := True;
P := TProcessUTF8.Create(nil);
try
P.Options := [poUsePipes, poWaitOnExit];
P.CommandLine := 'git --version';
try
P.Execute;
except
Result := False;
end;
finally
P.Destroy;
end;
end;
function TSvn2RevisionApplication.FindRevision: boolean;
var
@ -238,7 +257,7 @@ begin
if not Result then
begin
GitDir:= AppendPathDelim(SourceDirectory)+'.git';
if DirectoryExistsUTF8(GitDir) then
if DirectoryExistsUTF8(GitDir) and GitInPath then
begin
if IsThisGitUpstreamBranch then
Result := GetRevisionFromGitVersion