Git: Add git bash to tools menu

Can be useful to perform tasks that don't have
a dedicated UI in Creator.

In my setup, git bash was directly in the git
installation folder %ProgramFiles%\Git and
therefore one level above git.exe itself.

Change-Id: I1ca0d3439690170d7fb840bca17e2c412effe0a4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2020-04-29 18:10:00 +02:00
committed by André Hartmann
parent 97165f0cb8
commit f486ff7dab
3 changed files with 35 additions and 0 deletions

View File

@@ -303,6 +303,7 @@ public:
void gitkForCurrentFile();
void gitkForCurrentFolder();
void gitGui();
void gitBash();
void cleanProject();
void cleanRepository();
void updateSubmodules();
@@ -962,6 +963,14 @@ GitPluginPrivate::GitPluginPrivate()
= createRepositoryAction(gitToolsMenu, tr("Merge Tool"), "Git.MergeTool",
context, true, std::bind(&GitPluginPrivate::startMergeTool, this));
// --------------
if (Utils::HostOsInfo::isWindowsHost()) {
gitToolsMenu->addSeparator(context);
createRepositoryAction(gitToolsMenu, tr("Git Bash"), "Git.GitBash",
context, true, std::bind(&GitPluginPrivate::gitBash, this));
}
/* \"Git Tools" menu */
// --------------
@@ -1282,6 +1291,13 @@ void GitPluginPrivate::gitGui()
m_gitClient.launchGitGui(state.topLevel());
}
void GitPluginPrivate::gitBash()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient.launchGitBash(state.topLevel());
}
void GitPluginPrivate::startCommit(CommitType commitType)
{
if (!promptBeforeCommit())