public ITask DiscardChanges(GitStatusEntry[] gitStatusEntries) { Guard.ArgumentNotNullOrEmpty(gitStatusEntries, "gitStatusEntries"); ActionTask <GitStatusEntry[]> task = null; task = new ActionTask <GitStatusEntry[]>(token, (_, entries) => { var itemsToDelete = new List <NPath>(); var itemsToRevert = new List <string>(); foreach (var gitStatusEntry in gitStatusEntries) { if (gitStatusEntry.WorkTreeStatus == GitFileStatus.Added || gitStatusEntry.WorkTreeStatus == GitFileStatus.Untracked) { itemsToDelete.Add(gitStatusEntry.path.ToNPath().MakeAbsolute()); } else { itemsToRevert.Add(gitStatusEntry.path); } } if (itemsToDelete.Any()) { foreach (var itemToDelete in itemsToDelete) { itemToDelete.DeleteIfExists(); } } if (itemsToRevert.Any()) { task.Then(GitClient.Discard(itemsToRevert)); } } , () => gitStatusEntries) { Message = "Discarding changes..." }; return(HookupHandlers(task, true)); }