Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 484d6a9

Browse files
Merge pull request #905 from KonH/master
Spool files in GitClient.Remove() method to prevent possible issues
2 parents 3a70020 + 25897f8 commit 484d6a9

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/GitHub.Api/Git/GitClient.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public interface IGitClient
200200
ITask<string> DiscardAll(IOutputProcessor<string> processor = null);
201201

202202
/// <summary>
203-
/// Executes `git reset HEAD` command to remove files from the git index.
203+
/// Executes at least one `git reset HEAD` command to remove files from the git index.
204204
/// </summary>
205205
/// <param name="files">The files to remove</param>
206206
/// <param name="processor">A custom output processor instance</param>
@@ -549,8 +549,22 @@ public ITask<string> DiscardAll(IOutputProcessor<string> processor = null)
549549
public ITask<string> Remove(IList<string> files,
550550
IOutputProcessor<string> processor = null)
551551
{
552-
return new GitRemoveFromIndexTask(files, cancellationToken, processor)
553-
.Configure(processManager);
552+
GitRemoveFromIndexTask last = null;
553+
foreach (var batch in files.Spool(5000))
554+
{
555+
var current = new GitRemoveFromIndexTask(batch, cancellationToken, processor).Configure(processManager);
556+
if (last == null)
557+
{
558+
last = current;
559+
}
560+
else
561+
{
562+
last.Then(current);
563+
last = current;
564+
}
565+
}
566+
567+
return last;
554568
}
555569

556570
///<inheritdoc/>

0 commit comments

Comments
 (0)