Skip to content

Commit c7bc72a

Browse files
committed
installer: allow to skip downgrades without failing
When installing Git for Windows as part of a larger software suite, we may be interested in just making sure that Git for Windows is installed, being happy with newer versions, too. In such a case, we will want to skip downgrading Git for Windows, indicating success by setting the exit status to 0. This behavior needs to be triggered specifically by passing the /SKIPDOWNGRADE=1 option to the installer. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 1f0fc05 commit c7bc72a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

installer/install.iss

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ end;
593593
594594
function InitializeSetup:Boolean;
595595
var
596-
CurrentVersion,PreviousVersion:String;
596+
CurrentVersion,PreviousVersion,Msg:String;
597597
Version:TWindowsVersion;
598598
ErrorCode:Integer;
599599
begin
@@ -618,8 +618,18 @@ begin
618618
#if APP_VERSION!='0-test'
619619
if Result and not ParamIsSet('ALLOWDOWNGRADE') and RegQueryStringValue(HKEY_LOCAL_MACHINE,'Software\GitForWindows','CurrentVersion',PreviousVersion) then begin
620620
CurrentVersion:=ExpandConstant('{#APP_VERSION}');
621-
if (IsDowngrade(CurrentVersion,PreviousVersion)) and (SuppressibleMsgBox('Git for Windows '+PreviousVersion+' is currently installed.'+#13+'Do you really want to downgrade to Git for Windows '+CurrentVersion+'?',mbConfirmation,MB_YESNO or MB_DEFBUTTON2,IDNO)=IDNO) then
622-
Result:=False;
621+
if (IsDowngrade(CurrentVersion,PreviousVersion)) then begin
622+
if WizardSilent() and (ParamIsSet('SKIPDOWNGRADE') or ParamIsSet('VSNOTICE')) then begin
623+
Msg:='Skipping downgrade from '+PreviousVersion+' to '+CurrentVersion;
624+
if ParamIsSet('SKIPDOWNGRADE') or (ExpandConstant('{log}')='') then
625+
LogError(Msg)
626+
else
627+
Log(Msg);
628+
ExitEarlyWithSuccess();
629+
end;
630+
if SuppressibleMsgBox('Git for Windows '+PreviousVersion+' is currently installed.'+#13+'Do you really want to downgrade to Git for Windows '+CurrentVersion+'?',mbConfirmation,MB_YESNO or MB_DEFBUTTON2,IDNO)=IDNO then
631+
Result:=False;
632+
end;
623633
end;
624634
#endif
625635
end;

0 commit comments

Comments
 (0)