From 42282f9e15e94da12b40567225ca3b3728b69d9a Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Thu, 25 Sep 2014 22:58:16 +0200 Subject: [PATCH] RebaseDlg: Make Squash->Edit->Squash not to introduce unwanted commit (fixes issue #2126) Signed-off-by: Sven Strickroth --- src/Changelog.txt | 1 + src/TortoiseProc/RebaseDlg.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Changelog.txt b/src/Changelog.txt index fd95ed04b..3ef086ac8 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -14,6 +14,7 @@ Released: unreleased * Fixed issue #2306: TortoiseGitMerge ToolTip messages for Previous/next inline difference mixed up * Fixed issue #2308: Pressing ESC in the skip-worktree confirmation dialog box selects 'yes' * Fixed issue #2309: [Show log of aaaa..bbbb] on sub directory shows logs on root directory + * Fixed issue #2126: Rebase: Squash after conflict causes additional commit = Release 1.8.11.0 = Released: 2014-08-22 diff --git a/src/TortoiseProc/RebaseDlg.cpp b/src/TortoiseProc/RebaseDlg.cpp index c3188a77d..42cb1e202 100644 --- a/src/TortoiseProc/RebaseDlg.cpp +++ b/src/TortoiseProc/RebaseDlg.cpp @@ -1276,7 +1276,26 @@ void CRebaseDlg::OnBnClickedContinue() ::DeleteFile(tempfile); AddLogString(out); if (CheckNextCommitIsSquash() == 0 && m_RebaseStage != REBASE_SQUASH_EDIT) // remember commit msg after edit if next commit if squash; but don't do this if ...->squash(reset here)->pick->squash + { m_SquashMessage = str; + // reset parent so that we can do "git cherry-pick --no-commit" w/o introducing an unwanted commit + cmd = _T("git.exe reset --soft HEAD~1"); + m_ctrlTabCtrl.SetActiveTab(REBASE_TAB_LOG); + while (true) + { + out.Empty(); + if (g_Git.Run(cmd, &out, CP_UTF8)) + { + AddLogString(cmd); + AddLogString(CString(MAKEINTRESOURCE(IDS_FAIL))); + AddLogString(out); + if (CMessageBox::Show(m_hWnd, out + _T("\nRetry?"), _T("TortoiseGit"), MB_YESNO | MB_ICONERROR) != IDYES) + return; + } + else + break; + } + } else m_SquashMessage.Empty(); this->m_ctrlTabCtrl.SetActiveTab(REBASE_TAB_LOG); -- 2.11.4.GIT