diff --git a/LibGit2Sharp.Tests/ResetHeadFixture.cs b/LibGit2Sharp.Tests/ResetHeadFixture.cs index 20f7a4282..2a2927328 100644 --- a/LibGit2Sharp.Tests/ResetHeadFixture.cs +++ b/LibGit2Sharp.Tests/ResetHeadFixture.cs @@ -235,6 +235,8 @@ public void HardResetInABareRepositoryThrows() [Fact] public void HardResetUpdatesTheContentOfTheWorkingDirectory() { + bool progressCalled = false; + string path = SandboxStandardTestRepo(); using (var repo = new Repository(path)) { @@ -245,11 +247,16 @@ public void HardResetUpdatesTheContentOfTheWorkingDirectory() Assert.True(names.Count > 4); - repo.Reset(ResetMode.Hard, "HEAD~3"); + var commit = repo.Lookup("HEAD~3"); + repo.Reset(ResetMode.Hard, commit, new CheckoutOptions() + { + OnCheckoutProgress = (_path, _completed, _total) => { progressCalled = true; }, + }); names = new DirectoryInfo(repo.Info.WorkingDirectory).GetFileSystemInfos().Select(fsi => fsi.Name).ToList(); names.Sort(StringComparer.Ordinal); + Assert.Equal(true, progressCalled); Assert.Equal(new[] { ".git", "README", "WillNotBeRemoved.txt", "branch_file.txt", "new.txt", "new_untracked_file.txt" }, names); } } diff --git a/LibGit2Sharp/IRepository.cs b/LibGit2Sharp/IRepository.cs index c074b6829..e4524dde7 100644 --- a/LibGit2Sharp/IRepository.cs +++ b/LibGit2Sharp/IRepository.cs @@ -165,6 +165,15 @@ public interface IRepository : IDisposable /// The target commit object. void Reset(ResetMode resetMode, Commit commit); + /// + /// Sets to the specified commit and optionally resets the and + /// the content of the working tree to match. + /// + /// Flavor of reset operation to perform. + /// The target commit object. + /// Collection of parameters controlling checkout behavior. + void Reset(ResetMode resetMode, Commit commit, CheckoutOptions options); + /// /// Replaces entries in the with entries from the specified commit. /// diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs index b2df94152..6c55a1eae 100644 --- a/LibGit2Sharp/Repository.cs +++ b/LibGit2Sharp/Repository.cs @@ -985,15 +985,16 @@ public void Reset(ResetMode resetMode, Commit commit) } /// - /// Sets the current to the specified commit and optionally resets the and + /// Sets to the specified commit and optionally resets the and /// the content of the working tree to match. /// /// Flavor of reset operation to perform. /// The target commit object. /// Collection of parameters controlling checkout behavior. - private void Reset(ResetMode resetMode, Commit commit, IConvertableToGitCheckoutOpts opts) + public void Reset(ResetMode resetMode, Commit commit, CheckoutOptions opts) { Ensure.ArgumentNotNull(commit, "commit"); + Ensure.ArgumentNotNull(opts, "opts"); using (GitCheckoutOptsWrapper checkoutOptionsWrapper = new GitCheckoutOptsWrapper(opts)) {