public GitAddCommand(string basePath, GitPath[] items) { var itemList = new Queue <string>(items.Select(item => $"{item}")); var commandList = new List <GitCommand>(); var command = new GitCommand(basePath, "add"); var commandLength = command.ToString().Length; while (itemList.Any()) { var item = itemList.Dequeue(); if (commandLength + item.Length + 1 > 1024) { commandList.Add(command); command = new GitCommand(basePath, "add"); commandLength = command.ToString().Length; } commandLength += item.Length + 1; command.Add(item); } commandList.Add(command); this.commandList = commandList; }