Skip to content

Commit e7dd987

Browse files
authored
Merge pull request #311 from dscho/really-upgrade-to-gcm-core
Really upgrade to GCM Core
2 parents e33aec3 + 2e2c595 commit e7dd987

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

installer/install.iss

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -906,11 +906,12 @@ begin
906906
Result:=Result+1;
907907
end;
908908
909-
function IsDowngrade(CurrentVersion,PreviousVersion:String):Boolean;
909+
function IsDowngrade(CurrentVersion:String):Boolean;
910910
var
911-
Path:String;
911+
Path,PreviousVersion:String;
912912
i,j,CurrentLength,PreviousLength:Integer;
913913
begin
914+
PreviousVersion:=PreviousGitForWindowsVersion;
914915
Result:=(VersionCompare(CurrentVersion,PreviousVersion)<0);
915916
#ifdef GIT_VERSION
916917
if Result or (CountDots(CurrentVersion)>3) or (CountDots(PreviousVersion)>3) then begin
@@ -926,13 +927,16 @@ begin
926927
#endif
927928
end;
928929
929-
function IsUpgrade(CurrentVersion,PreviousVersion:String):Boolean;
930+
function IsUpgrade(CurrentVersion:String):Boolean;
931+
var
932+
PreviousVersion:String;
930933
begin
934+
PreviousVersion:=PreviousGitForWindowsVersion;
931935
// It is not an upgrade:
932936
// - if there was no previous version
933937
// - or if the previous version is identical to the current one (re-install)
934938
// - or if it is actually a downgrade
935-
Result:=(PreviousVersion<>'') and (CurrentVersion<>PreviousVersion) and not IsDowngrade(CurrentVersion,PreviousVersion)
939+
Result:=(PreviousVersion<>'') and (CurrentVersion<>PreviousVersion) and not IsDowngrade(CurrentVersion)
936940
end;
937941
938942
{ Represent a set as a string of comma-separated values }
@@ -1004,7 +1008,7 @@ begin
10041008
#if APP_VERSION!='0-test'
10051009
if Result and not ParamIsSet('ALLOWDOWNGRADE') then begin
10061010
CurrentVersion:=ExpandConstant('{#APP_VERSION}');
1007-
if IsDowngrade(CurrentVersion,PreviousGitForWindowsVersion) then begin
1011+
if IsDowngrade(CurrentVersion) then begin
10081012
if WizardSilent() and (ParamIsSet('SKIPDOWNGRADE') or ParamIsSet('VSNOTICE')) then begin
10091013
Msg:='Skipping downgrade from '+PreviousGitForWindowsVersion+' to '+CurrentVersion;
10101014
if ParamIsSet('SKIPDOWNGRADE') or (ExpandConstant('{log}')='') then
@@ -1658,7 +1662,7 @@ begin
16581662
Caption:='&Only show new options';
16591663
Width:=GetTextWidth(Caption,Font)+20; // 20 is the estimated width of the checkbox itself
16601664
Left:=WizardForm.BackButton.Left-Width-(WizardForm.CancelButton.Left-WizardForm.NextButton.Left-WizardForm.NextButton.Width);
1661-
Checked:=IsUpgrade(ExpandConstant('{#APP_VERSION}'),PreviousGitForWindowsVersion);
1665+
Checked:=IsUpgrade(ExpandConstant('{#APP_VERSION}'));
16621666
OnClick:=@AdjustNextButtonLabel;
16631667
Height:=WizardForm.CancelButton.Height;
16641668
Top:=WizardForm.CancelButton.Top;
@@ -2131,7 +2135,7 @@ begin
21312135
RdbGitCredentialManager[GCM_Core].Checked:=True;
21322136
end;
21332137
// Auto-upgrade GCM to GCM Core in version v2.29.0
2134-
if RdbGitCredentialManager[GCM_Classic].Checked and ((PreviousGitForWindowsVersion='') or IsDowngrade(PreviousGitForWindowsVersion,'2.29.0')) then begin
2138+
if RdbGitCredentialManager[GCM_Classic].Checked and ((PreviousGitForWindowsVersion='') or IsUpgrade('2.29.0')) then begin
21352139
RdbGitCredentialManager[GCM_Core].Checked:=True;
21362140
AddToSet(CustomPagesWithUnseenOptions,GitCredentialManagerPage);
21372141
end;

0 commit comments

Comments
 (0)