OSDN Git Service

PushDlg: Fix: Wrong remote selected after selection via ref-browser.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / PushDlg.cpp
index e26b462..fc606fe 100644 (file)
@@ -157,7 +157,7 @@ void CPushDlg::OnBnClickedRd()
 void CPushDlg::OnCbnSelchangeBranchSource()\r
 {\r
        // TODO: Add your control notification handler code here\r
-       m_BranchRemote.SetWindowTextW(m_BranchSource.GetString());\r
+       m_BranchRemote.AddString(m_BranchSource.GetString());\r
 }\r
 \r
 void CPushDlg::OnBnClickedOk()\r
@@ -200,12 +200,23 @@ void CPushDlg::OnBnClickedButtonBrowseSourceBranch()
 void CPushDlg::OnBnClickedButtonBrowseDestBranch()\r
 {\r
        CString remoteBranchName;\r
+       CString remoteName;\r
        m_BranchRemote.GetWindowText(remoteBranchName);\r
+       remoteName = m_Remote.GetString();\r
+       remoteBranchName = remoteName + '/' + remoteBranchName;\r
        remoteBranchName = CBrowseRefsDlg::PickRef(false, remoteBranchName, gPickRef_Remote);\r
        if(remoteBranchName.IsEmpty())\r
                return; //Canceled\r
        remoteBranchName = remoteBranchName.Mid(13);//Strip 'refs/remotes/'\r
-       remoteBranchName = remoteBranchName.Mid(remoteBranchName.Find('/') + 1); //Strip remote name (for example 'origin/')\r
+       int slashPlace = remoteBranchName.Find('/');\r
+       remoteName = remoteBranchName.Left(slashPlace);\r
+       remoteBranchName = remoteBranchName.Mid(slashPlace + 1); //Strip remote name (for example 'origin/')\r
 \r
-       m_BranchRemote.SetWindowText(remoteBranchName);\r
+       //Select remote\r
+       int remoteSel = m_Remote.FindStringExact(0,remoteName);\r
+       if(remoteSel >= 0)\r
+               m_Remote.SetCurSel(remoteSel);\r
+\r
+       //Select branch\r
+       m_BranchRemote.AddString(remoteBranchName);\r
 }\r