From 2f09b0d99f46e19c634f7fe2e4faf965a1ab8c9c Mon Sep 17 00:00:00 2001 From: Nicolas DENIS <38191912+theclickman@users.noreply.github.com> Date: Tue, 9 Sep 2025 07:25:31 -0400 Subject: [PATCH] Add check over Windows Integration to already exists during upgrade It is my suggestion for fising Bug 5683 I opened months ago. https://github.com/git-for-windows/git/issues/5683 It will enable preserving Windows Integration in any context of update - manually (it will check the option automatically if detected) or via silent update (winget or other path) by detecting if the Registry entries already exists and match the current installation at that time. Signed-off-by: Nicolas DENIS <38191912+theclickman@users.noreply.github.com> --- installer/install.iss | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/installer/install.iss b/installer/install.iss index dfa1e68e63..93cf0910fc 100644 --- a/installer/install.iss +++ b/installer/install.iss @@ -1904,6 +1904,40 @@ begin #endif end; +procedure PreselectShellIntegrationIfMatchingInstall(); +var + RootKey: Integer; + Cmd: String; + AppPath: String; +begin + AppPath := UninstallAppPath; // Set earlier in QueryUninstallValues() + + if AppPath = '' then + Exit; + + if IsAdminLoggedOn then + RootKey := HKEY_LOCAL_MACHINE + else + RootKey := HKEY_CURRENT_USER; + + // Git Bash Here + if RegQueryStringValue(RootKey, + 'SOFTWARE\Classes\Directory\shell\git_shell\command', '', Cmd) then + begin + if Pos(AppPath, Cmd) > 0 then + WizardSelectComponents('ext\shellhere'); + end; + + // Git GUI Here + if RegQueryStringValue(RootKey, + 'SOFTWARE\Classes\Directory\shell\git_gui\command', '', Cmd) then + begin + if Pos(AppPath, Cmd) > 0 then + WizardSelectComponents('ext\guihere'); + end; +end; + + procedure InitializeWizard; var PrevPageID,TabOrder,TopOfLabels,Top,Left:Integer; @@ -1923,6 +1957,9 @@ begin GetDefaultsFromGitConfig('ProgramData'); GetDefaultsFromGitConfig('system'); + // Check if Windows Integration already exists to reapply it during update + PreselectShellIntegrationIfMatchingInstall(); + ChosenOptions:=''; PrevPageID:=wpSelectProgramGroup;