1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
unit gitupdateunit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
implementation
uses
process, systemunit, lowlevelunit, refreshExecutableUnit;
var
updated: boolean;
myDir,baseDir,
output: string;
args: array of string;
initialization
updated:=false;
myDir:=extractFilePath(paramstr(0));
baseDir:=extractFilePath(leftStr(myDir,length(myDir)-1));
output:='';
setlength(args,2);
args[0]:='pull';
args[1]:='--all';
if runCommandInDir(myDir,'git',args,output) then begin
updated:=updated or (output<>'Already up-to-date.'#10);
if runCommandInDir(baseDir+'units','git',args,output) then begin
updated:=updated or (output<>'Already up-to-date.'#10);
if updated then
refreshExecutable(myDir);
end;
end;
setlength(args,0);
end.
|