bool CMassiveGitTaskBase::ExecuteCommands(volatile BOOL& cancel) { m_bUnused = false; int maxLength = 0; int firstCombine = 0; for (int i = 0; i < GetListCount(); ++i) { if (maxLength + GetListItem(i).GetLength() > MAX_COMMANDLINE_LENGTH || i == GetListCount() - 1 || cancel) { CString add; for (int j = firstCombine; j <= i; ++j) { add += L" \""; add += GetListItem(j); add += L'"'; } CString cmd, out; cmd.Format(L"git.exe %s %s%s", (LPCTSTR)m_sParams, m_bIsPath ? L"--" : L"", (LPCTSTR)add); int exitCode = g_Git.Run(cmd, &out, CP_UTF8); if (exitCode && !m_bIgnoreErrors) { ReportError(out, exitCode); return false; } if (m_bIsPath) { for (int j = firstCombine; j <= i; ++j) ReportProgress(m_pathList[j], j); } maxLength = 0; firstCombine = i+1; if (cancel) { ReportUserCanceled(); return false; } } else maxLength += 3 + GetListItem(i).GetLength(); } return true; }
bool CMassiveGitTaskBase::ExecuteCommands(volatile BOOL& cancel) { m_bUnused = false; int maxLength = 0; int firstCombine = 0; for (int i = 0; i < GetListCount(); ++i) { if (maxLength + GetListItem(i).GetLength() > MAX_COMMANDLINE_LENGTH || i == GetListCount() - 1 || cancel) { CString add; for (int j = firstCombine; j <= i; ++j) add += _T(" \"") + GetListItem(j) + _T("\""); CString cmd, out; cmd.Format(_T("git.exe %s %s%s"), m_sParams, m_bIsPath ? _T("--") : _T(""), add); if (g_Git.Run(cmd, &out, CP_UTF8) && !m_bIgnoreErrors) { ReportError(out); return false; } if (m_bIsPath) { for (int j = firstCombine; j <= i; ++j) ReportProgress(m_pathList[j], j); } maxLength = 0; firstCombine = i+1; if (cancel) { ReportUserCanceled(); return false; } } else { maxLength += 3 + GetListItem(i).GetLength(); } } return true; }