From 7fba0ca7e46b86efb3c37fb14a8376e2e6b8aa21 Mon Sep 17 00:00:00 2001 From: Johan 't Hart Date: Fri, 26 Jun 2009 22:16:31 +0200 Subject: [PATCH] Rebase: Select default upstream based on current tracked remote --- src/TortoiseProc/RebaseDlg.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/TortoiseProc/RebaseDlg.cpp b/src/TortoiseProc/RebaseDlg.cpp index 83c3067..74aaf91 100644 --- a/src/TortoiseProc/RebaseDlg.cpp +++ b/src/TortoiseProc/RebaseDlg.cpp @@ -367,6 +367,24 @@ void CRebaseDlg::LoadBranchInfo() m_UpstreamCtrl.AddString(m_Upstream); m_UpstreamCtrl.SetCurSel(m_UpstreamCtrl.GetCount()-1); } + else + { + //Select pull-remote from current branch + CString currentBranch = g_Git.GetSymbolicRef(); + CString configName; + configName.Format(L"branch.%s.remote", currentBranch); + CString pullRemote = g_Git.GetConfigValue(configName); + + //Select pull-branch from current branch + configName.Format(L"branch.%s.merge", currentBranch); + CString pullBranch = CGit::StripRefName(g_Git.GetConfigValue(configName)); + + CString defaultUpstream; + defaultUpstream.Format(L"remotes/%s/%s", pullRemote, pullBranch); + int found = m_UpstreamCtrl.FindStringExact(0, defaultUpstream); + if(found >= 0) + m_UpstreamCtrl.SetCurSel(found); + } } void CRebaseDlg::OnCbnSelchangeBranch() -- 2.11.0