From 900b1539120e7b4a1fccc529bb1dfe80ec6f5741 Mon Sep 17 00:00:00 2001 From: Shun Tsukamoto Date: Fri, 11 Dec 2020 14:43:54 +0100 Subject: [PATCH] Move prune (all remotes) setting to git config page Signed-off-by: Shun Tsukamoto Signed-off-by: Sven Strickroth --- Languages/Tortoise.pot | 10 ++++----- src/Changelog.txt | 1 + src/Resources/TortoiseProcENG.rc | 5 +++-- src/TortoiseProc/Settings/SettingGitConfig.cpp | 17 ++++++++++++++- src/TortoiseProc/Settings/SettingGitConfig.h | 3 ++- src/TortoiseProc/Settings/SettingGitRemote.cpp | 30 ++++---------------------- src/TortoiseProc/Settings/SettingGitRemote.h | 2 -- src/TortoiseProc/resource.h | 2 +- 8 files changed, 32 insertions(+), 38 deletions(-) diff --git a/Languages/Tortoise.pot b/Languages/Tortoise.pot index 97f28e19e..301ae37b1 100644 --- a/Languages/Tortoise.pot +++ b/Languages/Tortoise.pot @@ -7121,14 +7121,10 @@ msgstr "" msgid "Proxy Settings" msgstr "" -#. Resource IDs: (Dialog IDD_PULLFETCH: Control id 1603, Dialog IDD_SETTINREMOTE: Control id 1603) +#. Resource IDs: (Dialog IDD_PULLFETCH: Control id 1603, Dialog IDD_SETTINGIT_CONFIG: Control id 1603, Dialog IDD_SETTINREMOTE: Control id 1603) msgid "Prune" msgstr "" -#. Resource IDs: (Dialog IDD_SETTINREMOTE: Control id 1785) -msgid "Prune (All remotes)" -msgstr "" - #. Resource IDs: (Dialog IDD_SYNC: Control id 1611, IDS_PROGRS_TITLE_PULL) msgid "Pull" msgstr "" @@ -10354,6 +10350,10 @@ msgstr "" msgid "You asked to pull, but did not specify a remote branch." msgstr "" +#. Resource IDs: (IDS_PRUNE_OPTION_GUIDE) +msgid "You can configure it for all remotes or global on the Git settings page." +msgstr "" + #. Resource IDs: (Dialog IDD_SETTINGSOVERLAYHANDLERS: Control id 65535) msgid "You can disable specific Overlay handlers here.\nDisabled handlers won't use up an overlay slot and give other shell extensions a chance to show their overlays." msgstr "" diff --git a/src/Changelog.txt b/src/Changelog.txt index e7086ee1a..9ad54b007 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -12,6 +12,7 @@ Released: unreleased * Update libgit2 to 1.1.0 * Update Scintilla to 4.4.6 * Allow multiple ref selection in the Revision Graph Filter + * Move prune (all remotes) setting to git config page == Bug Fixes == * Fixed issue #3649: "multi-project pull/fetch/push" not working diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 14f2d572f..712284415 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -1595,7 +1595,8 @@ BEGIN COMBOBOX IDC_COMBO_AUTOCRLF,54,117,44,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Sa&feCrLf:",IDC_STATIC,112,119,32,8 COMBOBOX IDC_COMBO_SAFECRLF,149,117,44,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "QuotePath",IDC_CHECK_QUOTEPATH,"Button",BS_AUTO3STATE | WS_TABSTOP,14,140,279,10 + CONTROL "QuotePath",IDC_CHECK_QUOTEPATH,"Button",BS_AUTO3STATE | WS_TABSTOP,14,140,140,10 + CONTROL "Prune",IDC_CHECK_PRUNE,"Button",BS_AUTO3STATE | WS_TABSTOP,154,140,139,10 LTEXT "Save to:",IDC_STATIC,14,157,98,11 COMBOBOX IDC_COMBO_SETTINGS_SAFETO,113,156,105,15,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Edit &local .git/config",IDC_EDITLOCALGITCONFIG,14,178,90,14 @@ -1627,7 +1628,6 @@ BEGIN COMBOBOX IDC_COMBO_TAGOPT,144,102,80,12,CBS_DROPDOWNLIST | WS_TABSTOP CONTROL "Push Default",IDC_CHECK_PUSHDEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,104,68,10 CONTROL "Prune",IDC_CHECK_PRUNE,"Button",BS_AUTO3STATE | WS_TABSTOP,96,123,35,10 - CONTROL "Prune (All remotes)",IDC_CHECK_PRUNEALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,123,90,10 PUSHBUTTON "&Add New/Save",IDC_BUTTON_ADD,100,169,91,14 LTEXT "Remote:",IDC_STATIC,7,10,76,8 PUSHBUTTON "&Remove",IDC_BUTTON_REMOVE,100,189,91,14 @@ -5076,6 +5076,7 @@ BEGIN IDS_SYSTEM_GCMCORE "manager-core - all Windows users" IDS_GLOBAL_GCMCORE "manager-core - current Windows user" IDS_LOCAL_GCMCORE "manager-core - this repository only" + IDS_PRUNE_OPTION_GUIDE "You can configure it for all remotes or global on the Git settings page." END #endif // English (U.S.) resources diff --git a/src/TortoiseProc/Settings/SettingGitConfig.cpp b/src/TortoiseProc/Settings/SettingGitConfig.cpp index bc176fb0d..373c02c25 100644 --- a/src/TortoiseProc/Settings/SettingGitConfig.cpp +++ b/src/TortoiseProc/Settings/SettingGitConfig.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2017, 2019 - TortoiseGit +// Copyright (C) 2008-2017, 2019-2020 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -33,6 +33,7 @@ CSettingGitConfig::CSettingGitConfig() : ISettingsPropPage(CSettingGitConfig::IDD) , m_bNeedSave(false) , m_bQuotePath(TRUE) + , m_bPrune(FALSE) , m_bInheritUserName(FALSE) , m_bInheritEmail(FALSE) , m_bInheritSigningKey(FALSE) @@ -50,6 +51,7 @@ void CSettingGitConfig::DoDataExchange(CDataExchange* pDX) DDX_Text(pDX, IDC_GIT_USEREMAIL, m_UserEmail); DDX_Text(pDX, IDC_GIT_USERESINGNINGKEY, m_UserSigningKey); DDX_Check(pDX, IDC_CHECK_QUOTEPATH, m_bQuotePath); + DDX_Check(pDX, IDC_CHECK_PRUNE, m_bPrune); DDX_Check(pDX, IDC_CHECK_INHERIT_NAME, m_bInheritUserName); DDX_Check(pDX, IDC_CHECK_INHERIT_EMAIL, m_bInheritEmail); DDX_Check(pDX, IDC_CHECK_INHERIT_KEYID, m_bInheritSigningKey); @@ -64,6 +66,7 @@ BEGIN_MESSAGE_MAP(CSettingGitConfig, CPropertyPage) ON_EN_CHANGE(IDC_GIT_USERESINGNINGKEY, &CSettingGitConfig::OnChange) ON_CBN_SELCHANGE(IDC_COMBO_AUTOCRLF, &CSettingGitConfig::OnChange) ON_BN_CLICKED(IDC_CHECK_QUOTEPATH, &CSettingGitConfig::OnChange) + ON_BN_CLICKED(IDC_CHECK_PRUNE, &CSettingGitConfig::OnChange) ON_CBN_SELCHANGE(IDC_COMBO_SAFECRLF, &CSettingGitConfig::OnChange) ON_BN_CLICKED(IDC_CHECK_INHERIT_NAME, &CSettingGitConfig::OnChange) ON_BN_CLICKED(IDC_CHECK_INHERIT_EMAIL, &CSettingGitConfig::OnChange) @@ -187,6 +190,14 @@ void CSettingGitConfig::LoadDataImpl(CAutoConfig& config) m_bQuotePath = BST_INDETERMINATE; } + if (git_config_get_bool(&m_bPrune, config, "fetch.prune") == GIT_ENOTFOUND) + { + if (m_iConfigSource == CFG_SRC_EFFECTIVE) + m_bPrune = BST_UNCHECKED; + else + m_bPrune = BST_INDETERMINATE; + } + BOOL bSafeCrLf = FALSE; if (git_config_get_bool(&bSafeCrLf, config, "core.safecrlf") == GIT_ENOTFOUND) m_cSafeCrLf.SetCurSel(0); @@ -215,6 +226,7 @@ void CSettingGitConfig::EnDisableControls() GetDlgItem(IDC_GIT_USERESINGNINGKEY)->SendMessage(EM_SETREADONLY, m_iConfigSource == CFG_SRC_EFFECTIVE, 0); GetDlgItem(IDC_COMBO_AUTOCRLF)->EnableWindow(m_iConfigSource != CFG_SRC_EFFECTIVE); GetDlgItem(IDC_CHECK_QUOTEPATH)->EnableWindow(m_iConfigSource != CFG_SRC_EFFECTIVE); + GetDlgItem(IDC_CHECK_PRUNE)->EnableWindow(m_iConfigSource != CFG_SRC_EFFECTIVE); GetDlgItem(IDC_COMBO_SAFECRLF)->EnableWindow(m_iConfigSource != CFG_SRC_EFFECTIVE); GetDlgItem(IDC_COMBO_SETTINGS_SAFETO)->EnableWindow(m_iConfigSource != CFG_SRC_EFFECTIVE); GetDlgItem(IDC_CHECK_INHERIT_NAME)->EnableWindow(m_iConfigSource != CFG_SRC_EFFECTIVE); @@ -249,6 +261,9 @@ BOOL CSettingGitConfig::SafeDataImpl(CAutoConfig& config) if (!Save(config, L"core.quotepath", m_bQuotePath ? L"true" : L"false", m_bQuotePath == BST_INDETERMINATE)) return FALSE; + if (!Save(config, L"fetch.prune", m_bPrune ? L"true" : L"false", m_bPrune == BST_INDETERMINATE)) + return FALSE; + { CString autocrlf; m_cAutoCrLf.GetWindowText(autocrlf); diff --git a/src/TortoiseProc/Settings/SettingGitConfig.h b/src/TortoiseProc/Settings/SettingGitConfig.h index 6f95ff212..fe160aa76 100644 --- a/src/TortoiseProc/Settings/SettingGitConfig.h +++ b/src/TortoiseProc/Settings/SettingGitConfig.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2017, 2019 - TortoiseGit +// Copyright (C) 2008-2017, 2019-2020 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -66,5 +66,6 @@ protected: BOOL m_bInheritSigningKey; CComboBox m_cAutoCrLf; BOOL m_bQuotePath; + BOOL m_bPrune; CComboBox m_cSafeCrLf; }; diff --git a/src/TortoiseProc/Settings/SettingGitRemote.cpp b/src/TortoiseProc/Settings/SettingGitRemote.cpp index 8d82dee4d..55b527f56 100644 --- a/src/TortoiseProc/Settings/SettingGitRemote.cpp +++ b/src/TortoiseProc/Settings/SettingGitRemote.cpp @@ -37,7 +37,6 @@ CSettingGitRemote::CSettingGitRemote() : ISettingsPropPage(CSettingGitRemote::IDD) , m_bNoFetch(false) , m_bPrune(2) - , m_bPruneAll(FALSE) , m_bPushDefault(FALSE) { m_ChangedMask = 0; @@ -57,7 +56,6 @@ void CSettingGitRemote::DoDataExchange(CDataExchange* pDX) DDX_Text(pDX, IDC_EDIT_PUTTY_KEY, m_strPuttyKeyfile); DDX_Control(pDX, IDC_COMBO_TAGOPT, m_ctrlTagOpt); DDX_Check(pDX, IDC_CHECK_PRUNE, m_bPrune); - DDX_Check(pDX, IDC_CHECK_PRUNEALL, m_bPruneAll); DDX_Check(pDX, IDC_CHECK_PUSHDEFAULT, m_bPushDefault); } @@ -72,7 +70,6 @@ BEGIN_MESSAGE_MAP(CSettingGitRemote, CPropertyPage) ON_EN_CHANGE(IDC_EDIT_PUTTY_KEY, &CSettingGitRemote::OnEnChangeEditPuttyKey) ON_CBN_SELCHANGE(IDC_COMBO_TAGOPT, &CSettingGitRemote::OnCbnSelchangeComboTagOpt) ON_BN_CLICKED(IDC_CHECK_PRUNE, &CSettingGitRemote::OnBnClickedCheckprune) - ON_BN_CLICKED(IDC_CHECK_PRUNEALL, &CSettingGitRemote::OnBnClickedCheckpruneall) ON_BN_CLICKED(IDC_CHECK_PUSHDEFAULT, &CSettingGitRemote::OnBnClickedCheckpushdefault) ON_BN_CLICKED(IDC_BUTTON_REMOVE, &CSettingGitRemote::OnBnClickedButtonRemove) ON_BN_CLICKED(IDC_BUTTON_RENAME_REMOTE, &CSettingGitRemote::OnBnClickedButtonRenameRemote) @@ -97,7 +94,6 @@ BOOL CSettingGitRemote::OnInitDialog() ISettingsPropPage::OnInitDialog(); AdjustControlSize(IDC_CHECK_PRUNE); - AdjustControlSize(IDC_CHECK_PRUNEALL); AdjustControlSize(IDC_CHECK_PUSHDEFAULT); STRING_VECTOR remotes; @@ -111,17 +107,15 @@ BOOL CSettingGitRemote::OnInitDialog() m_ctrlTagOpt.AddString(CString(MAKEINTRESOURCE(IDS_ALL))); m_ctrlTagOpt.SetCurSel(0); - CString pruneAll = g_Git.GetConfigValue(L"fetch.prune"); - m_bPruneAll = pruneAll == L"true" ? TRUE : FALSE; - { CString tmp; tmp.Format(IDS_GITCONFIG_SETTING, L"remote.pushdefault"); m_tooltips.AddTool(IDC_CHECK_PUSHDEFAULT, tmp); tmp.Format(IDS_GITCONFIG_SETTING, L"remote..prune"); + CString guide; + guide.LoadString(IDS_PRUNE_OPTION_GUIDE); + tmp += L"\n" + guide; m_tooltips.AddTool(IDC_CHECK_PRUNE, tmp); - tmp.Format(IDS_GITCONFIG_SETTING, L"fetch.prune"); - m_tooltips.AddTool(IDC_CHECK_PRUNEALL, tmp); tmp.Format(IDS_GITCONFIG_SETTING, L"remote.tagopt"); m_tooltips.AddTool(IDC_COMBO_TAGOPT, tmp); } @@ -174,7 +168,7 @@ void CSettingGitRemote::OnBnClickedButtonAdd() return; } - m_ChangedMask = REMOTE_NAME | REMOTE_URL | REMOTE_PUTTYKEY | REMOTE_TAGOPT | REMOTE_PRUNE | REMOTE_PRUNEALL | REMOTE_PUSHDEFAULT | REMOTE_PUSHURL; + m_ChangedMask = REMOTE_NAME | REMOTE_URL | REMOTE_PUTTYKEY | REMOTE_TAGOPT | REMOTE_PRUNE | REMOTE_PUSHDEFAULT | REMOTE_PUSHURL; if(IsRemoteExist(m_strRemote)) { CString msg; @@ -290,8 +284,6 @@ void CSettingGitRemote::OnLbnSelchangeListRemote() cmd.Format(L"remote.%s.prune", static_cast(m_strRemote)); CString prune = g_Git.GetConfigValue(cmd); m_bPrune = prune == L"true" ? TRUE : prune == L"false" ? FALSE : 2; - CString pruneAll = g_Git.GetConfigValue(L"fetch.prune"); - m_bPruneAll = pruneAll == L"true" ? TRUE : FALSE; GetDlgItem(IDC_BUTTON_ADD)->EnableWindow(TRUE); GetDlgItem(IDC_BUTTON_REMOVE)->EnableWindow(TRUE); @@ -362,13 +354,6 @@ void CSettingGitRemote::OnBnClickedCheckprune() this->SetModified(); } -void CSettingGitRemote::OnBnClickedCheckpruneall() -{ - m_ChangedMask |= REMOTE_PRUNEALL; - UpdateData(); - SetModified(); -} - void CSettingGitRemote::OnBnClickedCheckpushdefault() { m_ChangedMask |= REMOTE_PUSHDEFAULT; @@ -453,13 +438,6 @@ BOOL CSettingGitRemote::OnApply() m_ChangedMask &= ~REMOTE_PUSHDEFAULT; } - if (m_ChangedMask & REMOTE_PRUNEALL) - { - if (!SaveGeneral(L"fetch.prune", m_bPruneAll == TRUE ? L"true" : L"false")) - return FALSE; - m_ChangedMask &= ~REMOTE_PRUNEALL; - } - if (m_ChangedMask && m_strRemote.Trim().IsEmpty()) { CMessageBox::Show(GetSafeHwnd(), IDS_PROC_GITCONFIG_REMOTEEMPTY, IDS_APPNAME, MB_OK | MB_ICONERROR); diff --git a/src/TortoiseProc/Settings/SettingGitRemote.h b/src/TortoiseProc/Settings/SettingGitRemote.h index 78edf0fa5..648399cfc 100644 --- a/src/TortoiseProc/Settings/SettingGitRemote.h +++ b/src/TortoiseProc/Settings/SettingGitRemote.h @@ -33,7 +33,6 @@ public: REMOTE_PUTTYKEY =0x4, REMOTE_TAGOPT =0x8, REMOTE_PRUNE =0x10, - REMOTE_PRUNEALL =0x20, REMOTE_PUSHDEFAULT = 0x40, REMOTE_PUSHURL =0x80, }; @@ -85,5 +84,4 @@ protected: CComboBox m_ctrlTagOpt; BOOL m_bPushDefault; BOOL m_bPrune; - BOOL m_bPruneAll; }; diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index d11151cdd..070d6c3a6 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -1430,6 +1430,7 @@ #define IDS_LOCAL_GCMCORE 1683 #define IDC_BUTTON_REVISION 1684 #define IDC_RUNFIRSTSTARTWIZARD 1684 +#define IDS_PRUNE_OPTION_GUIDE 1684 #define IDC_REPOBROWSER_URL 1685 #define IDC_REFLOG_BUTTONCLEARSTASH 1686 #define IDC_GROUP_IGNORE_TYPE 1686 @@ -1561,7 +1562,6 @@ #define IDC_PROGRESSDLG_SHOW_TIMES 1782 #define IDC_CHECK_INHERIT_BTLABEL 1783 #define IDC_CURRENTBRANCH 1784 -#define IDC_CHECK_PRUNEALL 1785 #define IDC_CHECK_PUSHDEFAULT 1786 #define IDC_TESTBUGTRAQREGEXBUTTON 1787 #define IDC_ENABLEDRAGCONTEXTMENU 1788 -- 2.11.4.GIT