CString csTitle;\r
\r
UINT mbIcon=MB_ICONQUESTION;\r
- csMessage=L"Are you sure you want to delete the ";\r
- if(wcsncmp(completeRefName,L"refs/heads",10)==0)\r
- {\r
- CString branchToDelete = completeRefName.Mid(11);\r
- csTitle.Format(L"Confirm deletion of branch %s", branchToDelete);\r
- csMessage += "branch:\r\n\r\n<b>";\r
+ csMessage = L"Are you sure you want to delete the ";\r
+\r
+ bool bIsRemoteBranch = false;\r
+ bool bIsBranch = false;\r
+ if (wcsncmp(completeRefName, L"refs/remotes",12)==0) {bIsBranch = true; bIsRemoteBranch = true;}\r
+ else if (wcsncmp(completeRefName, L"refs/heads",10)==0) {bIsBranch = true;}\r
+\r
+ if(bIsBranch)\r
+ {\r
+ CString branchToDelete = completeRefName.Mid(bIsRemoteBranch ? 13 : 11);\r
+ csTitle.Format(L"Confirm deletion of %sbranch %s", \r
+ bIsRemoteBranch? L"remote ": L"", \r
+ branchToDelete);\r
+ if(bIsRemoteBranch)\r
+ csMessage += L"<ct=0x0000FF><i>remote</i></ct> "; \r
+ csMessage += L"branch:\r\n\r\n<b>";\r
csMessage += branchToDelete;\r
- csMessage += "</b>";\r
+ csMessage += L"</b>";\r
\r
//Check if branch is fully merged in HEAD\r
CString branchHash = g_Git.GetHash(completeRefName);\r
if(commonAncestor != branchHash)\r
{\r
csMessage += L"\r\n\r\n<b>Warning:\r\nThis branch is not fully merged into HEAD.</b>";\r
- mbIcon=MB_ICONWARNING;\r
+ mbIcon = MB_ICONWARNING;\r
+ }\r
+ if(bIsRemoteBranch)\r
+ {\r
+ csMessage += L"\r\n\r\n<b>Warning:\r\nThis action will remove the branch on the remote.</b>";\r
+ mbIcon = MB_ICONWARNING;\r
}\r
}\r
else if(wcsncmp(completeRefName,L"refs/tags",9)==0)\r
\r
bool CBrowseRefsDlg::DoDeleteRef(CString completeRefName, bool bForce)\r
{\r
- if(wcsncmp(completeRefName,L"refs/heads",10)==0)\r
+ bool bIsRemoteBranch = false;\r
+ bool bIsBranch = false;\r
+ if (wcsncmp(completeRefName, L"refs/remotes",12)==0) {bIsBranch = true; bIsRemoteBranch = true;}\r
+ else if (wcsncmp(completeRefName, L"refs/heads",10)==0) {bIsBranch = true;}\r
+\r
+ if(bIsBranch)\r
{\r
- CString branchToDelete = completeRefName.Mid(11);\r
+ CString branchToDelete = completeRefName.Mid(bIsRemoteBranch ? 13 : 11);\r
CString cmd;\r
- cmd.Format(L"git.exe branch -%c %s",bForce?L'D':L'd',branchToDelete);\r
+ if(bIsRemoteBranch)\r
+ {\r
+ int slash = branchToDelete.Find(L'/');\r
+ if(slash < 0)\r
+ return false;\r
+ CString remoteName = branchToDelete.Left(slash);\r
+ CString remoteBranchToDelete = branchToDelete.Mid(slash + 1);\r
+ cmd.Format(L"git.exe push \"%s\" :%s", remoteName, remoteBranchToDelete);\r
+ }\r
+ else\r
+ cmd.Format(L"git.exe branch -%c %s",bForce?L'D':L'd',branchToDelete);\r
CString resultDummy;\r
if(g_Git.Run(cmd,&resultDummy,CP_UTF8)!=0)\r
{\r
bool bShowReflogOption = false;\r
bool bShowDeleteBranchOption = false;\r
bool bShowDeleteTagOption = false;\r
+ bool bShowDeleteRemoteBranchOption = false;\r
\r
if(selectedLeafs[0]->IsFrom(L"refs/heads"))\r
{\r
else if(selectedLeafs[0]->IsFrom(L"refs/remotes"))\r
{\r
bShowReflogOption = true;\r
+ bShowDeleteRemoteBranchOption = true;\r
}\r
else if(selectedLeafs[0]->IsFrom(L"refs/tags"))\r
{\r
bShowDeleteTagOption = true;\r
}\r
\r
- popupMenu.AppendMenuIcon(eCmd_ViewLog, L"Show Log", IDI_LOG);\r
- if(bShowReflogOption) popupMenu.AppendMenuIcon(eCmd_ShowReflog, L"Show Reflog", IDI_LOG);\r
- if(bShowDeleteTagOption) popupMenu.AppendMenuIcon(eCmd_DeleteTag, L"Delete Tag", IDI_DELETE);\r
- if(bShowDeleteBranchOption) popupMenu.AppendMenuIcon(eCmd_DeleteBranch, L"Delete Branch", IDI_DELETE);\r
+ popupMenu.AppendMenuIcon(eCmd_ViewLog, L"Show Log", IDI_LOG);\r
+ if(bShowReflogOption) popupMenu.AppendMenuIcon(eCmd_ShowReflog, L"Show Reflog", IDI_LOG);\r
+ if(bShowDeleteTagOption) popupMenu.AppendMenuIcon(eCmd_DeleteTag, L"Delete Tag", IDI_DELETE);\r
+ if(bShowDeleteBranchOption) popupMenu.AppendMenuIcon(eCmd_DeleteBranch, L"Delete Branch", IDI_DELETE);\r
+ if(bShowDeleteRemoteBranchOption) popupMenu.AppendMenuIcon(eCmd_DeleteRemoteBranch, L"Delete Remote Branch", IDI_DELETE);\r
\r
\r
\r
}\r
break;\r
case eCmd_DeleteBranch:\r
+ case eCmd_DeleteRemoteBranch:\r
{\r
if(ConfirmDeleteRef(selectedLeafs[0]->GetRefName()))\r
DoDeleteRef(selectedLeafs[0]->GetRefName(), true);\r