mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 13:09: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
|
const
|
||||||
RevisionIncComment = '// Created by Svn2RevisionInc';
|
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;
|
function TSvn2RevisionApplication.FindRevision: boolean;
|
||||||
var
|
var
|
||||||
@ -238,7 +257,7 @@ begin
|
|||||||
if not Result then
|
if not Result then
|
||||||
begin
|
begin
|
||||||
GitDir:= AppendPathDelim(SourceDirectory)+'.git';
|
GitDir:= AppendPathDelim(SourceDirectory)+'.git';
|
||||||
if DirectoryExistsUTF8(GitDir) then
|
if DirectoryExistsUTF8(GitDir) and GitInPath then
|
||||||
begin
|
begin
|
||||||
if IsThisGitUpstreamBranch then
|
if IsThisGitUpstreamBranch then
|
||||||
Result := GetRevisionFromGitVersion
|
Result := GetRevisionFromGitVersion
|
||||||
|
Loading…
Reference in New Issue
Block a user