1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2013-2014 - 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.
20 #include "ResetProgressCommand.h"
22 #include "../TGitCache/CacheInterface.h"
24 bool ResetProgressCommand::Run(CGitProgressList
* list
, CString
& sWindowTitle
, int& /*m_itemCountTotal*/, int& /*m_itemCount*/)
26 if (!g_Git
.UsingLibGit2(CGit::GIT_CMD_RESET
))
28 // should never run to here
33 list
->SetWindowTitle(IDS_PROGRS_TITLE_RESET
, g_Git
.m_CurrentDir
, sWindowTitle
);
34 list
->SetBackgroundImage(IDI_UPDATE_BKG
);
35 int resetTypesResource
[] = { IDS_RESET_SOFT
, IDS_RESET_MIXED
, IDS_RESET_HARD
};
36 list
->ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_TITLE_RESET
)) + _T(" ") + CString(MAKEINTRESOURCE(resetTypesResource
[m_resetType
])) + _T(" ") + m_revision
);
38 list
->ShowProgressBar();
39 CAutoRepository
repo(g_Git
.GetGitRepository());
42 list
->ReportGitError();
46 CBlockCacheForPath
block(g_Git
.m_CurrentDir
);
48 if (git_revparse_single(target
.GetPointer(), repo
, CUnicodeUtils::GetUTF8(m_revision
)))
50 if (git_reset(repo
, target
, (git_reset_t
)(m_resetType
+ 1), nullptr, nullptr, nullptr))
53 // Not setting m_PostCmdCallback here, as clone is only called from AppUtils.cpp
58 list
->ReportGitError();