mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 10:36:20 +02:00
tools: check if git can be called (is in path) before calling it
git-svn-id: trunk@37473 -
This commit is contained in:
parent
3bcf717da9
commit
fa0f36b694
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user