diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp index 0a937248cb4..21f9c63e14e 100644 --- a/src/plugins/git/branchview.cpp +++ b/src/plugins/git/branchview.cpp @@ -230,8 +230,11 @@ void BranchView::slotCustomContextMenu(const QPoint &point) contextMenu.addAction(tr("&Log"), this, [this] { log(selectedIndex()); }); contextMenu.addSeparator(); if (!currentSelected) { - if (currentLocal) - contextMenu.addAction(tr("Re&set"), this, &BranchView::reset); + auto resetMenu = new QMenu(tr("Re&set"), &contextMenu); + resetMenu->addAction(tr("&Hard"), this, [this] { reset("hard"); }); + resetMenu->addAction(tr("&Mixed"), this, [this] { reset("mixed"); }); + resetMenu->addAction(tr("&Soft"), this, [this] { reset("soft"); }); + contextMenu.addMenu(resetMenu); QString mergeTitle; if (isFastForwardMerge()) { contextMenu.addAction(tr("&Merge (Fast-Forward)"), this, [this] { merge(true); }); @@ -466,17 +469,17 @@ bool BranchView::rename() return false; } -bool BranchView::reset() +bool BranchView::reset(const QByteArray &resetType) { const QString currentName = m_model->fullName(m_model->currentBranch()); const QString branchName = m_model->fullName(selectedIndex()); if (currentName.isEmpty() || branchName.isEmpty()) return false; - if (QMessageBox::question(this, tr("Git Reset"), tr("Hard reset branch \"%1\" to \"%2\"?") + if (QMessageBox::question(this, tr("Git Reset"), tr("Reset branch \"%1\" to \"%2\"?") .arg(currentName).arg(branchName), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { - GitPlugin::client()->reset(m_repository, "--hard", branchName); + GitPlugin::client()->reset(m_repository, QLatin1String("--" + resetType), branchName); return true; } return false; diff --git a/src/plugins/git/branchview.h b/src/plugins/git/branchview.h index 7e400b704a0..71b2aeef393 100644 --- a/src/plugins/git/branchview.h +++ b/src/plugins/git/branchview.h @@ -76,7 +76,7 @@ private: bool checkout(); bool remove(); bool rename(); - bool reset(); + bool reset(const QByteArray &resetType); bool isFastForwardMerge(); bool merge(bool allowFastForward); void rebase();