From 2f6eb58cf5fdf7853cd2bbd57c83177a30f71289 Mon Sep 17 00:00:00 2001 From: Sup Yut Sum Date: Thu, 27 Feb 2014 23:22:23 +0800 Subject: [PATCH] If user attempts to create branch with same name as current branch, tell him to use reset command Signed-off-by: Sup Yut Sum --- Languages/Tortoise.pot | 4 ++++ src/Resources/TortoiseProcENG.rc | 2 ++ src/TortoiseProc/CreateBranchTagDlg.cpp | 5 +++++ src/TortoiseProc/resource.h | 1 + 4 files changed, 12 insertions(+) diff --git a/Languages/Tortoise.pot b/Languages/Tortoise.pot index cb4f7dfcf..52ec4656c 100644 --- a/Languages/Tortoise.pot +++ b/Languages/Tortoise.pot @@ -2333,6 +2333,10 @@ msgstr "" msgid "Cannot combine commits now.\r\nMake sure you are viewing the log of your current branch and no filters are applied." msgstr "" +#. Resource IDs: (94) +msgid "Cannot force updating current branch. Use reset command if you want to do so." +msgstr "" + #. Resource IDs: (1) #, c-format msgid "Cannot show blame. \"%s\" is not under version control by git." diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 647f9eb72..34b856073 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -3354,6 +3354,8 @@ BEGIN IDS_DIFFOPTION_IGNORBLANKLINES "Ignore blank lines" IDS_SELECTUPSTREAM "Please select upstream" IDS_SELECTBRANCH "Please select branch" + IDS_B_CANNOTFORCECURRENT + "Cannot force updating current branch. Use reset command if you want to do so." IDS_EXPORTFILE_TT "Location where the contents of the\nselected revision of the repository will be saved to." IDS_CHECKOUT_EXPORTDIR "Export directory:" END diff --git a/src/TortoiseProc/CreateBranchTagDlg.cpp b/src/TortoiseProc/CreateBranchTagDlg.cpp index d1e724c60..a3e76871b 100644 --- a/src/TortoiseProc/CreateBranchTagDlg.cpp +++ b/src/TortoiseProc/CreateBranchTagDlg.cpp @@ -170,6 +170,11 @@ void CCreateBranchTagDlg::OnBnClickedOk() } if (!m_bForce && g_Git.BranchTagExists(m_BranchTagName, !m_bIsTag)) { + if (!m_bIsTag && g_Git.GetCurrentBranch(true) == m_BranchTagName) + { + ShowEditBalloon(IDC_BRANCH_TAG, CString(MAKEINTRESOURCE(IDS_B_CANNOTFORCECURRENT)), CString(MAKEINTRESOURCE(IDS_WARN_WARNING))); + return; + } CString msg; if (m_bIsTag) msg.LoadString(IDS_T_EXISTS); diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index 5660efae6..be449a877 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -1064,6 +1064,7 @@ #define IDS_SELECTBRANCH 1494 #define IDC_RD_URL 1495 #define IDC_COLOR_LINE7 1495 +#define IDS_B_CANNOTFORCECURRENT 1495 #define IDC_REMOTE 1496 #define IDC_PACK 1497 #define IDC_TAGS 1499 -- 2.11.4.GIT