From ec0690a04b5b95e19dcec0fb5964097f14880d1a Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 28 Nov 2016 14:54:06 +0100 Subject: [PATCH] Also check git.exe version when setting it up Signed-off-by: Sven Strickroth --- src/TortoiseProc/ConfigureGitExe.h | 19 +++++++++++++++++++ src/TortoiseProc/TortoiseProc.cpp | 20 ++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/TortoiseProc/ConfigureGitExe.h b/src/TortoiseProc/ConfigureGitExe.h index 63157dfa4..04795e8dc 100644 --- a/src/TortoiseProc/ConfigureGitExe.h +++ b/src/TortoiseProc/ConfigureGitExe.h @@ -35,6 +35,22 @@ public: , m_regMsys2Hack(L"Software\\TortoiseGit\\Msys2Hack", FALSE) {}; + static bool CheckGitVersion(HWND hwnd) + { + if (CAppUtils::GetMsysgitVersion() >= 0x01090500) + return true; + + int ret = CMessageBox::ShowCheck(nullptr, IDS_PROC_OLDMSYSGIT, IDS_APPNAME, 1, IDI_EXCLAMATION, IDS_PROC_GOTOMSYSGITWEBSITE, IDS_ABORTBUTTON, IDS_IGNOREBUTTON, L"OldMsysgitVersionWarning", IDS_PROC_NOTSHOWAGAINIGNORE); + if (ret == 3) + return true; + + CMessageBox::RemoveRegistryKey(L"OldMsysgitVersionWarning"); // only store answer if it is "Ignore" + if (ret == 1) + ShellExecute(hwnd, L"open", GIT_FOR_WINDOWS_URL, nullptr, nullptr, SW_SHOW); + + return false; + } + protected: CRegDWORD m_regCygwinHack; CRegDWORD m_regMsys2Hack; @@ -188,6 +204,9 @@ protected: return false; } + CGit::ms_LastMsysGitVersion = 0; + if (!CheckGitVersion(hwnd)) + return false; return true; } diff --git a/src/TortoiseProc/TortoiseProc.cpp b/src/TortoiseProc/TortoiseProc.cpp index fc684a716..802871e6f 100644 --- a/src/TortoiseProc/TortoiseProc.cpp +++ b/src/TortoiseProc/TortoiseProc.cpp @@ -37,6 +37,7 @@ #include "JumpListHelpers.h" #include "SinglePropSheetDlg.h" #include "Settings\setmainpage.h" +#include "ConfigureGitExe.h" #include "Libraries.h" #include "TaskbarUUID.h" #include "ProjectProperties.h" @@ -200,7 +201,7 @@ BOOL CTortoiseProcApp::InitInstance() UINT ret = CMessageBox::Show(nullptr, IDS_PROC_NOMSYSGIT, IDS_APPNAME, 3, IDI_HAND, IDS_PROC_SETMSYSGITPATH, IDS_PROC_GOTOMSYSGITWEBSITE, IDS_ABORTBUTTON); if(ret == 2) { - ShellExecute(nullptr, L"open", L"https://git-for-windows.github.io/", nullptr, nullptr, SW_SHOW); + ShellExecute(nullptr, L"open", GIT_FOR_WINDOWS_URL, nullptr, nullptr, SW_SHOW); } else if(ret == 1) { @@ -209,21 +210,8 @@ BOOL CTortoiseProcApp::InitInstance() } return FALSE; } - if (CAppUtils::GetMsysgitVersion() < 0x01090500) - { - int ret = CMessageBox::ShowCheck(nullptr, IDS_PROC_OLDMSYSGIT, IDS_APPNAME, 1, IDI_EXCLAMATION, IDS_PROC_GOTOMSYSGITWEBSITE, IDS_ABORTBUTTON, IDS_IGNOREBUTTON, L"OldMsysgitVersionWarning", IDS_PROC_NOTSHOWAGAINIGNORE); - if (ret == 1) - { - CMessageBox::RemoveRegistryKey(L"OldMsysgitVersionWarning"); // only store answer if it is "Ignore" - ShellExecute(nullptr, L"open", L"https://git-for-windows.github.io/", nullptr, nullptr, SW_SHOW); - return FALSE; - } - else if (ret == 2) - { - CMessageBox::RemoveRegistryKey(L"OldMsysgitVersionWarning"); // only store answer if it is "Ignore" - return FALSE; - } - } + if (!CConfigureGitExe::CheckGitVersion(hWndExplorer)) + return FALSE; { CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": Registering Crash Report ...\n"); -- 2.11.4.GIT