Fix typos
[TortoiseGit.git] / src / TortoiseProc / Commands / BisectCommand.cpp
blobbd847584f9dd5cdae5b43be61c7fa591cd06b610
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2013, 2015-2016, 2018-2019 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include "stdafx.h"
20 #include "BisectCommand.h"
21 #include "MessageBox.h"
22 #include "AppUtils.h"
23 #include "ProgressDlg.h"
24 #include "resource.h"
26 bool BisectCommand::Execute()
28 if (!GitAdminDir::HasAdminDir(g_Git.m_CurrentDir))
30 CMessageBox::Show(GetExplorerHWND(), IDS_NOWORKINGCOPY, IDS_APPNAME, MB_ICONERROR);
31 return false;
34 CTGitPath path = g_Git.m_CurrentDir;
36 if (parser.HasKey(L"start") && !path.IsBisectActive())
38 CString lastGood, firstBad;
39 if (parser.HasKey(L"good"))
40 lastGood = parser.GetVal(L"good");
41 if (parser.HasKey(L"bad"))
42 firstBad = parser.GetVal(L"bad");
44 return CAppUtils::BisectStart(GetExplorerHWND(), lastGood, firstBad);
46 else if ((this->parser.HasKey(L"good") || this->parser.HasKey(L"bad") || this->parser.HasKey(L"skip") || this->parser.HasKey(L"reset")) && path.IsBisectActive())
48 CString op;
49 CString ref;
51 if (parser.HasKey(L"good"))
52 g_Git.GetBisectTerms(&op, nullptr);
53 else if (parser.HasKey(L"bad"))
54 g_Git.GetBisectTerms(nullptr, &op);
55 else if (this->parser.HasKey(L"skip"))
56 op = L"skip";
57 else if (parser.HasKey(L"reset"))
58 op = L"reset";
60 if (parser.HasKey(L"ref") && !parser.HasKey(L"reset"))
61 ref = parser.GetVal(L"ref");
63 return CAppUtils::BisectOperation(GetExplorerHWND(), op, ref);
65 else
66 MessageBox(GetExplorerHWND(), L"Operation unknown or not allowed.", L"TortoiseGit", MB_OK | MB_ICONINFORMATION);
67 return false;