From 304dfcb5522d5db7269d8ac3ec1167793973d4cb Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Tue, 11 Jul 2017 19:25:29 +0200 Subject: [PATCH] Allow to control whether fetch uses default refspec for named remotes Signed-off-by: Sven Strickroth --- doc/source/en/TortoiseGit/tgit_dug/dug_settings_advanced.xml | 9 +++++++++ src/TortoiseProc/PullFetchDlg.cpp | 9 +++++---- src/TortoiseProc/PullFetchDlg.h | 4 +++- src/TortoiseProc/Settings/SettingsAdvanced.cpp | 6 +++++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/source/en/TortoiseGit/tgit_dug/dug_settings_advanced.xml b/doc/source/en/TortoiseGit/tgit_dug/dug_settings_advanced.xml index 14cabf828..5725fdde5 100644 --- a/doc/source/en/TortoiseGit/tgit_dug/dug_settings_advanced.xml +++ b/doc/source/en/TortoiseGit/tgit_dug/dug_settings_advanced.xml @@ -268,6 +268,15 @@ + NamedRemoteFetchAll + + + When set to false, fetch and pull don't fetch the default refspec for a named remote. + The default is true. + + + + NoSortLocalBranchesFirst diff --git a/src/TortoiseProc/PullFetchDlg.cpp b/src/TortoiseProc/PullFetchDlg.cpp index 0b10ff73c..1413bbdb1 100644 --- a/src/TortoiseProc/PullFetchDlg.cpp +++ b/src/TortoiseProc/PullFetchDlg.cpp @@ -48,6 +48,7 @@ CPullFetchDlg::CPullFetchDlg(CWnd* pParent /*=nullptr*/) , m_bPrune(BST_INDETERMINATE) , m_bAutoLoad(CAppUtils::IsSSHPutty()) , m_bAutoLoadEnable(CAppUtils::IsSSHPutty()) + , m_bNamedRemoteFetchAll(CRegDWORD(L"Software\\TortoiseGit\\NamedRemoteFetchAll", true)) { } @@ -205,7 +206,7 @@ BOOL CPullFetchDlg::OnInitDialog() m_Remote.SetMaxHistoryItems(0x7FFFFFFF); m_Other.EnableWindow(FALSE); m_RemoteBranch.SetCaseSensitive(TRUE); - if(!m_IsPull) + if (!m_IsPull && !m_bNamedRemoteFetchAll) { m_RemoteBranch.EnableWindow(FALSE); GetDlgItem(IDC_BUTTON_BROWSE_REF)->EnableWindow(FALSE); @@ -351,7 +352,7 @@ void CPullFetchDlg::OnBnClickedRd() DialogEnableWindow(IDC_CHECK_REBASE, TRUE); m_bRebase = m_bRebaseActivatedInConfigForPull; UpdateData(FALSE); - if(!m_IsPull) + if (!m_IsPull && !m_bNamedRemoteFetchAll) m_RemoteBranch.EnableWindow(FALSE); } if( GetCheckedRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD) == IDC_OTHER_RD) @@ -389,8 +390,8 @@ void CPullFetchDlg::OnBnClickedOk() { m_RemoteURL=m_Remote.GetString(); m_bAllRemotes = (m_Remote.GetCurSel() == 0 && m_Remote.GetCount() > 1 && !m_IsPull); - if( !m_IsPull || - (m_configPullRemote == m_RemoteURL && m_configPullBranch == m_RemoteBranch.GetString() )) + if (!m_bNamedRemoteFetchAll && (!m_IsPull || + (m_configPullRemote == m_RemoteURL && m_configPullBranch == m_RemoteBranch.GetString()))) //When fetching or when pulling from the configured tracking branch, dont explicitly set the remote branch name, //because otherwise git will not update the remote tracking branches. m_RemoteBranchName.Empty(); diff --git a/src/TortoiseProc/PullFetchDlg.h b/src/TortoiseProc/PullFetchDlg.h index f4b2fe2b1..d0e027203 100644 --- a/src/TortoiseProc/PullFetchDlg.h +++ b/src/TortoiseProc/PullFetchDlg.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2016 - TortoiseGit +// Copyright (C) 2008-2017 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -75,6 +75,8 @@ protected: CHyperLink m_RemoteManage; + bool m_bNamedRemoteFetchAll; + afx_msg void OnCbnSelchangeRemote(); afx_msg void OnBnClickedRd(); afx_msg void OnBnClickedOk(); diff --git a/src/TortoiseProc/Settings/SettingsAdvanced.cpp b/src/TortoiseProc/Settings/SettingsAdvanced.cpp index bfedfb886..c355ca986 100644 --- a/src/TortoiseProc/Settings/SettingsAdvanced.cpp +++ b/src/TortoiseProc/Settings/SettingsAdvanced.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2012-2016 - TortoiseGit +// Copyright (C) 2012-2017 - TortoiseGit // Copyright (C) 2009-2011, 2013 - TortoiseSVN // This program is free software; you can redistribute it and/or @@ -102,6 +102,10 @@ CSettingsAdvanced::CSettingsAdvanced() settings[i].type = CSettingsAdvanced::SettingTypeBoolean; settings[i++].def.b = false; + settings[i].sName = L"NamedRemoteFetchAll"; + settings[i].type = CSettingsAdvanced::SettingTypeBoolean; + settings[i++].def.b = true; + settings[i].sName = L"NoSortLocalBranchesFirst"; settings[i].type = CSettingsAdvanced::SettingTypeBoolean; settings[i++].def.b = false; -- 2.11.4.GIT