From f37a4ebb17eb1301f9039045e11ccb64a8398cc7 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Sat, 31 Oct 2015 14:17:02 +0100 Subject: [PATCH] Fix compilation warnings --- LibGit2Sharp.Tests/MergeFixture.cs | 9 ++++----- LibGit2Sharp.Tests/NetworkFixture.cs | 2 +- LibGit2Sharp.Tests/PackBuilderFixture.cs | 14 ++------------ LibGit2Sharp.Tests/RevertFixture.cs | 4 ++-- LibGit2Sharp.Tests/SmartSubtransportFixture.cs | 2 +- LibGit2Sharp.Tests/StatusFixture.cs | 2 +- LibGit2Sharp.Tests/TestHelpers/FileExportFilter.cs | 1 - LibGit2Sharp/Filter.cs | 1 - LibGit2Sharp/IRepository.cs | 2 +- LibGit2Sharp/RebaseOperationImpl.cs | 10 +++------- 10 files changed, 15 insertions(+), 32 deletions(-) diff --git a/LibGit2Sharp.Tests/MergeFixture.cs b/LibGit2Sharp.Tests/MergeFixture.cs index 2153e85e6..55282e10d 100644 --- a/LibGit2Sharp.Tests/MergeFixture.cs +++ b/LibGit2Sharp.Tests/MergeFixture.cs @@ -361,7 +361,7 @@ public void MergeReportsCheckoutProgress() OnCheckoutProgress = (path, completed, total) => wasCalled = true, }; - MergeResult result = repo.Merge(commitToMerge, Constants.Signature, options); + repo.Merge(commitToMerge, Constants.Signature, options); Assert.True(wasCalled); } @@ -384,7 +384,7 @@ public void MergeReportsCheckoutNotifications() CheckoutNotifyFlags = CheckoutNotifyFlags.Updated, }; - MergeResult result = repo.Merge(commitToMerge, Constants.Signature, options); + repo.Merge(commitToMerge, Constants.Signature, options); Assert.True(wasCalled); Assert.Equal(CheckoutNotifyFlags.Updated, actualNotifyFlags); @@ -406,7 +406,7 @@ public void FastForwardMergeReportsCheckoutProgress() OnCheckoutProgress = (path, completed, total) => wasCalled = true, }; - MergeResult result = repo.Merge(commitToMerge, Constants.Signature, options); + repo.Merge(commitToMerge, Constants.Signature, options); Assert.True(wasCalled); } @@ -429,7 +429,7 @@ public void FastForwardMergeReportsCheckoutNotifications() CheckoutNotifyFlags = CheckoutNotifyFlags.Updated, }; - MergeResult result = repo.Merge(commitToMerge, Constants.Signature, options); + repo.Merge(commitToMerge, Constants.Signature, options); Assert.True(wasCalled); Assert.Equal(CheckoutNotifyFlags.Updated, actualNotifyFlags); @@ -665,7 +665,6 @@ public void MergeCanSpecifyMergeFileFavorOption(MergeFileFavor fileFavorFlag) Branch branch = repo.Branches[conflictBranchName]; Assert.NotNull(branch); - var status = repo.RetrieveStatus(); MergeOptions mergeOptions = new MergeOptions() { MergeFileFavor = fileFavorFlag, diff --git a/LibGit2Sharp.Tests/NetworkFixture.cs b/LibGit2Sharp.Tests/NetworkFixture.cs index 3383234f0..46623a663 100644 --- a/LibGit2Sharp.Tests/NetworkFixture.cs +++ b/LibGit2Sharp.Tests/NetworkFixture.cs @@ -189,7 +189,7 @@ public void CanPullIntoEmptyRepo() using (var repo = new Repository(repoPath)) { // Set up remote - Remote remote = repo.Network.Remotes.Add(remoteName, url); + repo.Network.Remotes.Add(remoteName, url); // Set up tracking information repo.Branches.Update(repo.Head, diff --git a/LibGit2Sharp.Tests/PackBuilderFixture.cs b/LibGit2Sharp.Tests/PackBuilderFixture.cs index 44e358158..3d0071df0 100644 --- a/LibGit2Sharp.Tests/PackBuilderFixture.cs +++ b/LibGit2Sharp.Tests/PackBuilderFixture.cs @@ -103,23 +103,13 @@ internal void AddingObjectsTestDelegate(IRepository repo, PackBuilder builder) [Fact] public void ExceptionIfPathDoesNotExist() { - PackBuilderOptions pbo; - - Assert.Throws(() => - { - pbo = new PackBuilderOptions("aaa"); - }); + Assert.Throws(() => new PackBuilderOptions("aaa")); } [Fact] public void ExceptionIfPathEqualsNull() { - PackBuilderOptions pbo; - - Assert.Throws(() => - { - pbo = new PackBuilderOptions(null); - }); + Assert.Throws(() => new PackBuilderOptions(null)); } [Fact] diff --git a/LibGit2Sharp.Tests/RevertFixture.cs b/LibGit2Sharp.Tests/RevertFixture.cs index d01fb6a77..b57728764 100644 --- a/LibGit2Sharp.Tests/RevertFixture.cs +++ b/LibGit2Sharp.Tests/RevertFixture.cs @@ -67,8 +67,6 @@ public void CanRevertAndNotCommit() string path = SandboxRevertTestRepo(); using (var repo = new Repository(path)) { - string modifiedFileFullPath = Path.Combine(repo.Info.WorkingDirectory, revertedFile); - // Checkout the revert branch. Branch branch = repo.Checkout(revertBranchName); Assert.NotNull(branch); @@ -160,6 +158,7 @@ public void RevertWithFileConflictStrategyOption(CheckoutFileConflictStrategy co }; RevertResult result = repo.Revert(repo.Head.Tip.Parents.First(), Constants.Signature, options); + Assert.Equal(RevertStatus.Conflicts, result.Status); // Verify there is a conflict. Assert.False(repo.Index.IsFullyMerged); @@ -242,6 +241,7 @@ public void RevertReportsCheckoutNotification() repo.Revert(repo.Head.Tip, Constants.Signature, options); Assert.True(wasCalled); + Assert.Equal(CheckoutNotifyFlags.Updated, actualNotifyFlags); } } diff --git a/LibGit2Sharp.Tests/SmartSubtransportFixture.cs b/LibGit2Sharp.Tests/SmartSubtransportFixture.cs index 9d71d3f3a..452bc8a8e 100644 --- a/LibGit2Sharp.Tests/SmartSubtransportFixture.cs +++ b/LibGit2Sharp.Tests/SmartSubtransportFixture.cs @@ -38,7 +38,7 @@ public void CustomSmartSubtransportTest(string scheme, string url) registration = GlobalSettings.RegisterSmartSubtransport(scheme); Assert.NotNull(registration); - using (var repo = new Repository(scd.DirectoryPath)) + using (var repo = new Repository(repoPath)) { Remote remote = repo.Network.Remotes.Add(remoteName, url); diff --git a/LibGit2Sharp.Tests/StatusFixture.cs b/LibGit2Sharp.Tests/StatusFixture.cs index 773eb7e46..3c9bc0023 100644 --- a/LibGit2Sharp.Tests/StatusFixture.cs +++ b/LibGit2Sharp.Tests/StatusFixture.cs @@ -99,7 +99,7 @@ public void RetrievingTheStatusOfADirectoryThrows() var path = SandboxStandardTestRepoGitDir(); using (var repo = new Repository(path)) { - Assert.Throws(() => { FileStatus status = repo.RetrieveStatus("1"); }); + Assert.Throws(() => { repo.RetrieveStatus("1"); }); } } diff --git a/LibGit2Sharp.Tests/TestHelpers/FileExportFilter.cs b/LibGit2Sharp.Tests/TestHelpers/FileExportFilter.cs index f68a03412..b03b8d2c1 100644 --- a/LibGit2Sharp.Tests/TestHelpers/FileExportFilter.cs +++ b/LibGit2Sharp.Tests/TestHelpers/FileExportFilter.cs @@ -77,7 +77,6 @@ protected override void Smudge(string path, string root, Stream input, Stream ou { SmudgeCalledCount++; - string filename = Path.GetFileName(path); StringBuilder text = new StringBuilder(); byte[] buffer = new byte[64 * 1024]; diff --git a/LibGit2Sharp/Filter.cs b/LibGit2Sharp/Filter.cs index e7dbc910b..b9aab9c7b 100644 --- a/LibGit2Sharp/Filter.cs +++ b/LibGit2Sharp/Filter.cs @@ -52,7 +52,6 @@ protected Filter(string name, IEnumerable attributes) private readonly string name; private readonly IEnumerable attributes; private readonly GitFilter gitFilter; - private readonly object @lock = new object(); private GitWriteStream thisStream; private GitWriteStream nextStream; diff --git a/LibGit2Sharp/IRepository.cs b/LibGit2Sharp/IRepository.cs index e4524dde7..317a0e76b 100644 --- a/LibGit2Sharp/IRepository.cs +++ b/LibGit2Sharp/IRepository.cs @@ -171,7 +171,7 @@ public interface IRepository : IDisposable /// /// Flavor of reset operation to perform. /// The target commit object. - /// Collection of parameters controlling checkout behavior. + /// Collection of parameters controlling checkout behavior. void Reset(ResetMode resetMode, Commit commit, CheckoutOptions options); /// diff --git a/LibGit2Sharp/RebaseOperationImpl.cs b/LibGit2Sharp/RebaseOperationImpl.cs index 9fb3cf228..abb4537c3 100644 --- a/LibGit2Sharp/RebaseOperationImpl.cs +++ b/LibGit2Sharp/RebaseOperationImpl.cs @@ -43,24 +43,20 @@ public static RebaseResult Run(RebaseSafeHandle rebaseOperationHandle, else { // No step to apply - need to complete the rebase. - rebaseResult = CompleteRebase(rebaseOperationHandle, committer, rebaseResult); + rebaseResult = CompleteRebase(rebaseOperationHandle, committer); } } return rebaseResult; } - private static RebaseResult CompleteRebase(RebaseSafeHandle rebaseOperationHandle, Identity committer, RebaseResult rebaseResult) + private static RebaseResult CompleteRebase(RebaseSafeHandle rebaseOperationHandle, Identity committer) { long totalStepCount = Proxy.git_rebase_operation_entrycount(rebaseOperationHandle); - GitRebaseOptions gitRebaseOptions = new GitRebaseOptions() - { - version = 1, - }; // Rebase is completed! Proxy.git_rebase_finish(rebaseOperationHandle, committer); - rebaseResult = new RebaseResult(RebaseStatus.Complete, + var rebaseResult = new RebaseResult(RebaseStatus.Complete, totalStepCount, totalStepCount, null);