From 9f1bf6e9976e12cc11720462845dfe63a414fd5b Mon Sep 17 00:00:00 2001 From: Sup Yut Sum Date: Sat, 26 Jan 2013 22:39:11 +0800 Subject: [PATCH] If running on Win XP or Vista, use a smaller command line max length Signed-off-by: Sup Yut Sum --- src/TortoiseProc/MassiveGitTask.cpp | 8 +++++++- src/TortoiseProc/MassiveGitTask.h | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/TortoiseProc/MassiveGitTask.cpp b/src/TortoiseProc/MassiveGitTask.cpp index c2c1d02be..8d5302a0b 100644 --- a/src/TortoiseProc/MassiveGitTask.cpp +++ b/src/TortoiseProc/MassiveGitTask.cpp @@ -21,6 +21,12 @@ #include "TortoiseProc.h" #include "MassiveGitTask.h" #include "MessageBox.h" +#include "SysInfo.h" + +#define MAX_COMMANDLINE_LENGTH_WINXP 1700 +#define MAX_COMMANDLINE_LENGTH_WIN7 30000 + +static int maxCommandLineLength = SysInfo::Instance().IsWin7OrLater() ? MAX_COMMANDLINE_LENGTH_WIN7 : MAX_COMMANDLINE_LENGTH_WINXP; CMassiveGitTask::CMassiveGitTask(CString gitParameters) : m_bUnused(true) @@ -75,7 +81,7 @@ bool CMassiveGitTask::ExecuteCommands(BOOL &cancel) int firstCombine = 0; for(int i = 0; i < m_pathList.GetCount(); i++) { - if (maxLength + m_pathList[i].GetGitPathString().GetLength() > MAX_COMMANDLINE_LENGTH || i == m_pathList.GetCount() - 1 || cancel) + if (maxLength + m_pathList[i].GetGitPathString().GetLength() > maxCommandLineLength || i == m_pathList.GetCount() - 1 || cancel) { CString add; for (int j = firstCombine; j <= i; j++) diff --git a/src/TortoiseProc/MassiveGitTask.h b/src/TortoiseProc/MassiveGitTask.h index 1cc93c025..455071f02 100644 --- a/src/TortoiseProc/MassiveGitTask.h +++ b/src/TortoiseProc/MassiveGitTask.h @@ -21,8 +21,6 @@ #include "GitProgressDlg.h" #include "TGitPath.h" -#define MAX_COMMANDLINE_LENGTH 30000 - typedef BOOL (CGitProgressDlg::*NOTIFY_CALLBACK)(const CTGitPath& path, git_wc_notify_action_t action, int status, CString *strErr); class CMassiveGitTask -- 2.11.4.GIT