Skip to content

Commit a20efed

Browse files
authored
Merge pull request #314 from dscho/record-default-branch-choice-correctly-in-the-installer
installer: two fixes regarding the default branch name choice
2 parents fd31539 + 160716e commit a20efed

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

installer/install.iss

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,28 @@ begin
16311631
WizardForm.ActiveControl:=EdtDefaultBranch;
16321632
end;
16331633
1634+
procedure DefaultBranchNameChanged(Sender: TObject);
1635+
var
1636+
IsValidBranchName:Boolean;
1637+
begin
1638+
if EdtDefaultBranch.Enabled then begin
1639+
// Disallow illegal ref names
1640+
with EdtDefaultBranch do
1641+
IsValidBranchName:=(Text<>'') and (Text<>'@') and
1642+
(Pos('..',Text)=0) and (Pos('@{',Text)=0) and (Pos('//',Text)=0) and
1643+
(Pos(#8,Text)=0) and (Pos(' ',Text)=0) and (Pos(':',Text)=0) and
1644+
(Pos('?',Text)=0) and (Pos('[',Text)=0) and (Pos('\',Text)=0) and
1645+
(Pos('^',Text)=0) and (Pos('~',Text)=0) and (Pos(#127,Text)=0) and
1646+
(Pos('/.','/'+Text)=0) and (Pos('./',Text+'/')=0) and (Pos('.lock/',Text+'/')=0);
1647+
if (WizardForm.CurPageID=DefaultBranchPage.ID) then
1648+
Wizardform.NextButton.Enabled:=IsValidBranchName;
1649+
if IsValidBranchName then
1650+
EdtDefaultBranch.Color:=clWhite
1651+
else
1652+
EdtDefaultBranch.Color:=clRed;
1653+
end;
1654+
end;
1655+
16341656
procedure QueryUninstallValues; forward;
16351657
16361658
procedure InitializeWizard;
@@ -1888,6 +1910,7 @@ begin
18881910
TabOrder:=TabOrder+1;
18891911
EdtDefaultBranch.Text:='main';
18901912
EdtDefaultBranch.Enabled:=False;
1913+
EdtDefaultBranch.OnChange:=@DefaultBranchNameChanged;
18911914
Top:=Top+13+24;
18921915
18931916
LblInfo:=TLabel.Create(DefaultBranchPage);
@@ -1899,11 +1922,13 @@ begin
18991922
// Restore the setting chosen during a previous install.
19001923
Data:=ReplayChoice('Default Branch Option','');
19011924
case Data of
1902-
'': RdbDefaultBranch[DB_Unspecified].Checked:=True;
1925+
'': RdbDefaultBranch[DB_Unspecified].Checked:=True;
1926+
' ': RdbDefaultBranch[DB_Unspecified].Checked:=True;
19031927
else begin
19041928
RdbDefaultBranch[DB_Manual].Checked:=True;
19051929
EdtDefaultBranch.Text:=Data;
19061930
EdtDefaultBranch.Enabled:=True;
1931+
DefaultBranchNameChanged(NIL);
19071932
end end;
19081933
19091934
(*
@@ -3162,7 +3187,7 @@ begin
31623187
RecordChoice(PreviousDataKey,'Custom Editor Path',CustomEditorData);
31633188
31643189
// Default Branch options.
3165-
Data:='';
3190+
Data:=' ';
31663191
if RdbDefaultBranch[DB_Manual].Checked then
31673192
Data:=EdtDefaultBranch.Text;
31683193
RecordChoice(PreviousDataKey,'Default Branch Option',Data);

0 commit comments

Comments
 (0)