mirror of https://gitlab.com/basile.b/dexed.git
fix error displayed after refreshing list of git branches
and when opening a project that's not a repo
This commit is contained in:
parent
9c3460a501
commit
c8c69e3f40
|
@ -4054,7 +4054,6 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCEMainForm.gitBranchMenuItemClick(sender: TObject);
|
procedure TCEMainForm.gitBranchMenuItemClick(sender: TObject);
|
||||||
var
|
var
|
||||||
p: TProcess;
|
p: TProcess;
|
||||||
|
@ -4062,6 +4061,8 @@ var
|
||||||
i: integer;
|
i: integer;
|
||||||
b: string;
|
b: string;
|
||||||
begin
|
begin
|
||||||
|
if not assigned(fProject) then
|
||||||
|
exit;
|
||||||
p := TProcess.Create(nil);
|
p := TProcess.Create(nil);
|
||||||
r := TStringList.Create;
|
r := TStringList.Create;
|
||||||
b := TMenuItem(sender).Caption;
|
b := TMenuItem(sender).Caption;
|
||||||
|
@ -4093,8 +4094,16 @@ var
|
||||||
r: TStringList;
|
r: TStringList;
|
||||||
i: integer;
|
i: integer;
|
||||||
m: TMenuItem;
|
m: TMenuItem;
|
||||||
|
a: boolean;
|
||||||
begin
|
begin
|
||||||
mnuGitBranch.Clear;
|
if not assigned(fProject) then
|
||||||
|
exit;
|
||||||
|
a := mnuGitBranch.Count >= 2;
|
||||||
|
if a then
|
||||||
|
while mnuGitBranch.Count <> 2 do
|
||||||
|
mnuGitBranch.delete(mnuGitBranch.Count-1);
|
||||||
|
if not DirectoryExistsUTF8(fProject.basePath + DirectorySeparator + '.git') then
|
||||||
|
exit;
|
||||||
p := TProcess.Create(nil);
|
p := TProcess.Create(nil);
|
||||||
r := TStringList.Create;
|
r := TStringList.Create;
|
||||||
try
|
try
|
||||||
|
@ -4109,10 +4118,13 @@ begin
|
||||||
p.Execute;
|
p.Execute;
|
||||||
processOutputToStrings(p,r);
|
processOutputToStrings(p,r);
|
||||||
while p.Running do ;
|
while p.Running do ;
|
||||||
|
if not a then
|
||||||
|
begin
|
||||||
m := TMenuItem.Create(mnuGitBranch);
|
m := TMenuItem.Create(mnuGitBranch);
|
||||||
m.action := actProjGitBranchesUpd;
|
m.action := actProjGitBranchesUpd;
|
||||||
mnuGitBranch.Add(m);
|
mnuGitBranch.Add(m);
|
||||||
mnuGitBranch.AddSeparator;
|
mnuGitBranch.AddSeparator;
|
||||||
|
end;
|
||||||
for i:= 0 to r.Count-1 do
|
for i:= 0 to r.Count-1 do
|
||||||
begin
|
begin
|
||||||
m := TMenuItem.Create(mnuGitBranch);
|
m := TMenuItem.Create(mnuGitBranch);
|
||||||
|
|
Loading…
Reference in New Issue