From 0eed453cabb29e4a4b24eb82e0525ce1fb5df840 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Fri, 22 Nov 2024 22:48:54 -0500 Subject: [PATCH] Run dotnet format --- LibGit2Sharp.Tests/BlameFixture.cs | 10 +- LibGit2Sharp.Tests/CheckoutFixture.cs | 8 +- LibGit2Sharp.Tests/ConflictFixture.cs | 4 +- LibGit2Sharp.Tests/DescribeFixture.cs | 4 +- LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs | 6 +- .../DiffWorkdirToIndexFixture.cs | 4 +- LibGit2Sharp.Tests/FileHistoryFixture.cs | 2 +- LibGit2Sharp.Tests/MergeFixture.cs | 10 +- LibGit2Sharp.Tests/NoteFixture.cs | 2 +- LibGit2Sharp.Tests/OdbBackendFixture.cs | 8 +- .../PatchEntryChangesFixture.cs | 56 +++---- LibGit2Sharp.Tests/RebaseFixture.cs | 4 +- LibGit2Sharp.Tests/RefSpecFixture.cs | 2 +- LibGit2Sharp.Tests/ReferenceFixture.cs | 4 +- LibGit2Sharp.Tests/RemoveFixture.cs | 6 +- .../RepositoryOptionsFixture.cs | 4 +- LibGit2Sharp.Tests/ResetHeadFixture.cs | 2 +- LibGit2Sharp.Tests/RevertFixture.cs | 10 +- LibGit2Sharp.Tests/SetErrorFixture.cs | 4 +- LibGit2Sharp.Tests/StashFixture.cs | 18 +-- LibGit2Sharp.Tests/TagFixture.cs | 2 +- LibGit2Sharp.Tests/TreeDefinitionFixture.cs | 8 +- LibGit2Sharp/AfterRebaseStepInfo.cs | 2 +- LibGit2Sharp/BlameHunk.cs | 4 +- LibGit2Sharp/CertificateSsh.cs | 6 +- LibGit2Sharp/CertificateX509.cs | 4 +- LibGit2Sharp/Core/Ensure.cs | 4 +- LibGit2Sharp/Core/GitBlame.cs | 2 +- LibGit2Sharp/Core/GitCertificateSshType.cs | 2 +- LibGit2Sharp/Core/Handles/Objects.cs | 50 +++--- LibGit2Sharp/Core/Handles/Objects.tt | 2 +- LibGit2Sharp/Core/Opaques.cs | 48 +++--- LibGit2Sharp/Core/Proxy.cs | 144 +++++++++--------- LibGit2Sharp/DiffTargets.cs | 2 +- LibGit2Sharp/Filter.cs | 2 +- LibGit2Sharp/FilterSource.cs | 2 +- LibGit2Sharp/IDiffResult.cs | 2 +- LibGit2Sharp/Index.cs | 2 +- LibGit2Sharp/IndexReucEntryCollection.cs | 2 +- LibGit2Sharp/ObjectId.cs | 4 +- LibGit2Sharp/Rebase.cs | 2 +- LibGit2Sharp/RefSpec.cs | 4 +- LibGit2Sharp/RefSpecCollection.cs | 4 +- LibGit2Sharp/ReferenceCollection.cs | 2 +- LibGit2Sharp/Remote.cs | 3 +- LibGit2Sharp/RemoteCallbacks.cs | 6 +- LibGit2Sharp/RemoteCollection.cs | 3 +- LibGit2Sharp/RepositoryExtensions.cs | 2 +- LibGit2Sharp/RepositoryStatus.cs | 2 +- LibGit2Sharp/RevertResult.cs | 2 +- LibGit2Sharp/SimilarityOptions.cs | 12 +- LibGit2Sharp/SmartSubtransport.cs | 8 +- LibGit2Sharp/TagCollection.cs | 2 +- LibGit2Sharp/TransientIndex.cs | 2 +- LibGit2Sharp/Tree.cs | 3 +- LibGit2Sharp/Worktree.cs | 2 +- LibGit2Sharp/WorktreeCollection.cs | 6 +- 57 files changed, 266 insertions(+), 261 deletions(-) diff --git a/LibGit2Sharp.Tests/BlameFixture.cs b/LibGit2Sharp.Tests/BlameFixture.cs index da63dc124..8cefcfb45 100644 --- a/LibGit2Sharp.Tests/BlameFixture.cs +++ b/LibGit2Sharp.Tests/BlameFixture.cs @@ -62,10 +62,10 @@ public void CanBlameFromVariousTypes() string path = SandboxBareTestRepo(); using (var repo = new Repository(path)) { - AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions {StartingAt = "HEAD" })); - AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions {StartingAt = repo.Head })); - AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions {StartingAt = repo.Head.Tip })); - AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions {StartingAt = repo.Branches["master"]})); + AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions { StartingAt = "HEAD" })); + AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions { StartingAt = repo.Head })); + AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions { StartingAt = repo.Head.Tip })); + AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions { StartingAt = repo.Branches["master"] })); } } @@ -78,7 +78,7 @@ public void CanStopBlame() // $ git blame .\new.txt // 9fd738e8 (Scott Chacon 2010-05-24 10:19:19 -0700 1) my new file // (be3563a comes after 9fd738e8) - var blame = repo.Blame("new.txt", new BlameOptions {StoppingAt = "be3563a"}); + var blame = repo.Blame("new.txt", new BlameOptions { StoppingAt = "be3563a" }); Assert.StartsWith("be3563a", blame[0].FinalCommit.Sha); } } diff --git a/LibGit2Sharp.Tests/CheckoutFixture.cs b/LibGit2Sharp.Tests/CheckoutFixture.cs index 8962cbc1d..045e20e1f 100644 --- a/LibGit2Sharp.Tests/CheckoutFixture.cs +++ b/LibGit2Sharp.Tests/CheckoutFixture.cs @@ -269,7 +269,7 @@ public void CanForcefullyCheckoutWithConflictingStagedChanges() Assert.Throws(() => Commands.Checkout(repo, master.CanonicalName)); // Checkout with force option should succeed. - Commands.Checkout(repo, master.CanonicalName, new CheckoutOptions() { CheckoutModifiers = CheckoutModifiers.Force}); + Commands.Checkout(repo, master.CanonicalName, new CheckoutOptions() { CheckoutModifiers = CheckoutModifiers.Force }); // Assert that master branch is checked out. Assert.True(repo.Branches["master"].IsCurrentRepositoryHead); @@ -411,7 +411,7 @@ public void CheckingOutThroughBranchCallsCheckoutProgress() Branch branch = repo.Branches[otherBranchName]; Commands.Checkout(repo, branch, - new CheckoutOptions { OnCheckoutProgress = (path, completed, total) => wasCalled = true}); + new CheckoutOptions { OnCheckoutProgress = (path, completed, total) => wasCalled = true }); Assert.True(wasCalled); } @@ -427,7 +427,7 @@ public void CheckingOutThroughRepositoryCallsCheckoutProgress() PopulateBasicRepository(repo); bool wasCalled = false; - Commands.Checkout(repo, otherBranchName, new CheckoutOptions() { OnCheckoutProgress = (path, completed, total) => wasCalled = true}); + Commands.Checkout(repo, otherBranchName, new CheckoutOptions() { OnCheckoutProgress = (path, completed, total) => wasCalled = true }); Assert.True(wasCalled); } @@ -779,7 +779,7 @@ public void CheckoutFromDetachedHead(string commitPointer) public void CheckoutBranchFromDetachedHead() { string path = SandboxStandardTestRepo(); - using (var repo = new Repository(path, new RepositoryOptions{ Identity = Constants.Identity })) + using (var repo = new Repository(path, new RepositoryOptions { Identity = Constants.Identity })) { // Set the working directory to the current head ResetAndCleanWorkingDirectory(repo); diff --git a/LibGit2Sharp.Tests/ConflictFixture.cs b/LibGit2Sharp.Tests/ConflictFixture.cs index b28270b7e..6317bf431 100644 --- a/LibGit2Sharp.Tests/ConflictFixture.cs +++ b/LibGit2Sharp.Tests/ConflictFixture.cs @@ -48,7 +48,7 @@ private static List RenameConflictData [Theory] [InlineData(true, "ancestor-and-ours.txt", true, false, FileStatus.DeletedFromIndex, 2)] - [InlineData(false, "ancestor-and-ours.txt", true, true, FileStatus.DeletedFromIndex |FileStatus.NewInWorkdir, 2)] + [InlineData(false, "ancestor-and-ours.txt", true, true, FileStatus.DeletedFromIndex | FileStatus.NewInWorkdir, 2)] [InlineData(true, "ancestor-and-theirs.txt", true, false, FileStatus.Nonexistent, 2)] [InlineData(false, "ancestor-and-theirs.txt", true, true, FileStatus.NewInWorkdir, 2)] [InlineData(true, "ancestor-only.txt", false, false, FileStatus.Nonexistent, 1)] @@ -101,7 +101,7 @@ public void CanGetOriginalNamesOfRenameConflicts() Assert.Equal(expected.Count, actual.Count()); int i = 0; - foreach(var name in actual) + foreach (var name in actual) { Assert.Equal(expected[i][0], name.Ancestor); Assert.Equal(expected[i][1], name.Ours); diff --git a/LibGit2Sharp.Tests/DescribeFixture.cs b/LibGit2Sharp.Tests/DescribeFixture.cs index ca859b9cd..bb2cacd06 100644 --- a/LibGit2Sharp.Tests/DescribeFixture.cs +++ b/LibGit2Sharp.Tests/DescribeFixture.cs @@ -23,7 +23,7 @@ public void CanDescribeACommit() // No lightweight tags can either be used to describe "master" Assert.Throws(() => repo.Describe(masterTip, - new DescribeOptions{ Strategy = DescribeStrategy.Tags })); + new DescribeOptions { Strategy = DescribeStrategy.Tags })); repo.ApplyTag("myTag", "5b5b025afb0b4c913b4c338a42934a3863bf3644"); Assert.Equal("myTag-5-g4c062a6", repo.Describe(masterTip, @@ -47,7 +47,7 @@ public void CanDescribeACommit() var anotherTip = repo.Branches["ForLackOfABetterName"].Tip; Assert.Equal("test", repo.Describe(anotherTip)); Assert.Equal("test-0-g7b43849", repo.Describe(anotherTip, - new DescribeOptions{ AlwaysRenderLongFormat = true })); + new DescribeOptions { AlwaysRenderLongFormat = true })); } } diff --git a/LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs b/LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs index 9212dfa99..8c2956331 100644 --- a/LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs +++ b/LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs @@ -1263,7 +1263,7 @@ public void DiffThrowsANotFoundExceptionIfATreeIsMissing() string repoPath = SandboxBareTestRepo(); // Manually delete the tree object to simulate a partial clone - File.Delete(Path.Combine(repoPath, "objects", "58", "1f9824ecaf824221bd36edf5430f2739a7c4f5")); + File.Delete(Path.Combine(repoPath, "objects", "58", "1f9824ecaf824221bd36edf5430f2739a7c4f5")); using (var repo = new Repository(repoPath)) { @@ -1282,12 +1282,12 @@ public void DiffThrowsANotFoundExceptionIfATreeIsMissing() Assert.Throws(() => { - using (repo.Diff.Compare(commit.Tree, otherCommit.Tree)) {} + using (repo.Diff.Compare(commit.Tree, otherCommit.Tree)) { } }); Assert.Throws(() => { - using (repo.Diff.Compare(otherCommit.Tree, commit.Tree)) {} + using (repo.Diff.Compare(otherCommit.Tree, commit.Tree)) { } }); } } diff --git a/LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs b/LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs index 430859577..c6ef700bb 100644 --- a/LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs +++ b/LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs @@ -137,7 +137,7 @@ public void ComparingReliesOnProvidedConfigEntriesIfAny() using (var repo = new Repository(path)) { SetFilemode(repo, true); - using(var changes = repo.Diff.Compare(new[] { file })) + using (var changes = repo.Diff.Compare(new[] { file })) { Assert.Single(changes); @@ -150,7 +150,7 @@ public void ComparingReliesOnProvidedConfigEntriesIfAny() using (var repo = new Repository(path)) { SetFilemode(repo, false); - using(var changes = repo.Diff.Compare(new[] { file })) + using (var changes = repo.Diff.Compare(new[] { file })) { Assert.Empty(changes); } diff --git a/LibGit2Sharp.Tests/FileHistoryFixture.cs b/LibGit2Sharp.Tests/FileHistoryFixture.cs index e6465d1ac..dcbd0e6d8 100644 --- a/LibGit2Sharp.Tests/FileHistoryFixture.cs +++ b/LibGit2Sharp.Tests/FileHistoryFixture.cs @@ -163,7 +163,7 @@ public void CanTellComplexCommitHistory() var commit4 = MakeAndCommitChange(repo, repoPath, newPath1, "I have done it again!"); // Perform tests. - var commitFilter = new CommitFilter () { SortBy = CommitSortStrategies.Topological }; + var commitFilter = new CommitFilter() { SortBy = CommitSortStrategies.Topological }; var fileHistoryEntries = repo.Commits.QueryBy(newPath1, commitFilter).ToList(); var changedBlobs = fileHistoryEntries.Blobs().Distinct().ToList(); diff --git a/LibGit2Sharp.Tests/MergeFixture.cs b/LibGit2Sharp.Tests/MergeFixture.cs index 7ce3ff496..7b1fda718 100644 --- a/LibGit2Sharp.Tests/MergeFixture.cs +++ b/LibGit2Sharp.Tests/MergeFixture.cs @@ -323,7 +323,7 @@ public void CanFastForwardCommit(bool fromDetachedHead, FastForwardStrategy fast string path = SandboxMergeTestRepo(); using (var repo = new Repository(path)) { - if(fromDetachedHead) + if (fromDetachedHead) { Commands.Checkout(repo, repo.Head.Tip.Id.Sha); } @@ -512,7 +512,7 @@ public void CanMergeAndNotCommit() { Commit commitToMerge = repo.Branches["normal_merge"].Tip; - MergeResult result = repo.Merge(commitToMerge, Constants.Signature, new MergeOptions() { CommitOnSuccess = false}); + MergeResult result = repo.Merge(commitToMerge, Constants.Signature, new MergeOptions() { CommitOnSuccess = false }); Assert.Equal(MergeStatus.NonFastForward, result.Status); Assert.Null(result.Commit); @@ -649,7 +649,7 @@ public void CanSpecifyConflictFileStrategy(CheckoutFileConflictStrategy conflict // Get the blob containing the expected content. Blob expectedBlob = null; - switch(conflictStrategy) + switch (conflictStrategy) { case CheckoutFileConflictStrategy.Theirs: expectedBlob = repo.Lookup(conflict.Theirs.Id); @@ -731,7 +731,7 @@ public void CanMergeBranch(string branchName, FastForwardStrategy strategy, Merg string path = SandboxMergeTestRepo(); using (var repo = new Repository(path)) { - Branch branch = repo. Branches[branchName]; + Branch branch = repo.Branches[branchName]; MergeResult result = repo.Merge(branch, Constants.Signature, new MergeOptions() { FastForwardStrategy = strategy }); Assert.Equal(expectedMergeStatus, result.Status); @@ -748,7 +748,7 @@ public void CanMergeIntoOrphanedBranch() repo.Refs.Add("HEAD", "refs/heads/orphan", true); // Remove entries from the working directory - foreach(var entry in repo.RetrieveStatus()) + foreach (var entry in repo.RetrieveStatus()) { Commands.Unstage(repo, entry.FilePath); Commands.Remove(repo, entry.FilePath, true); diff --git a/LibGit2Sharp.Tests/NoteFixture.cs b/LibGit2Sharp.Tests/NoteFixture.cs index 98801e3b2..4f23ced5c 100644 --- a/LibGit2Sharp.Tests/NoteFixture.cs +++ b/LibGit2Sharp.Tests/NoteFixture.cs @@ -56,7 +56,7 @@ public void RetrievingNotesFromAGitObjectWhichHasNoNoteYieldsNoResult() [Fact] public void CanRetrieveNotesFromAGitObject() { - var expectedMessages = new [] { "Just Note, don't you understand?\n", "Nope\n", "Not Nope, Note!\n" }; + var expectedMessages = new[] { "Just Note, don't you understand?\n", "Nope\n", "Not Nope, Note!\n" }; string path = SandboxBareTestRepo(); using (var repo = new Repository(path)) diff --git a/LibGit2Sharp.Tests/OdbBackendFixture.cs b/LibGit2Sharp.Tests/OdbBackendFixture.cs index 975d0e88c..65011ce0f 100644 --- a/LibGit2Sharp.Tests/OdbBackendFixture.cs +++ b/LibGit2Sharp.Tests/OdbBackendFixture.cs @@ -26,7 +26,7 @@ private static Commit AddCommitToRepo(IRepository repo) var commit = repo.Commit("Initial commit", author, author); relativeFilepath = "big.txt"; - var zeros = new string('0', 32*1024 + 3); + var zeros = new string('0', 32 * 1024 + 3); Touch(repo.Info.WorkingDirectory, relativeFilepath, zeros); Commands.Stage(repo, relativeFilepath); @@ -145,7 +145,7 @@ public void CanEnumerateTheContentOfTheObjectDatabase() AddCommitToRepo(repo); - var expected = new[]{ "1fe3126", "2b297e6", "6518215", "9daeafb" }; + var expected = new[] { "1fe3126", "2b297e6", "6518215", "9daeafb" }; IEnumerable objs = repo.ObjectDatabase; @@ -296,7 +296,7 @@ public override int Read(ObjectId oid, out UnmanagedMemoryStream data, out Objec if (!m_objectIdToContent.TryGetValue(oid, out gitObject)) { - return (int) ReturnCode.GIT_ENOTFOUND; + return (int)ReturnCode.GIT_ENOTFOUND; } data = Allocate(gitObject.Length); @@ -411,7 +411,7 @@ public override int ExistsPrefix(string shortSha, out ObjectId found) if (numFound > 1) { found = null; - return (int) ReturnCode.GIT_EAMBIGUOUS; + return (int)ReturnCode.GIT_EAMBIGUOUS; } } diff --git a/LibGit2Sharp.Tests/PatchEntryChangesFixture.cs b/LibGit2Sharp.Tests/PatchEntryChangesFixture.cs index dc2552a10..ff4949aa4 100644 --- a/LibGit2Sharp.Tests/PatchEntryChangesFixture.cs +++ b/LibGit2Sharp.Tests/PatchEntryChangesFixture.cs @@ -8,37 +8,37 @@ namespace LibGit2Sharp.Tests { - public class PatchEntryChangesFixture : BaseFixture - { - [Fact] - public void PatchEntryBasics() + public class PatchEntryChangesFixture : BaseFixture { - // Init test repo - var path = SandboxStandardTestRepoGitDir(); - string file = "numbers.txt"; + [Fact] + public void PatchEntryBasics() + { + // Init test repo + var path = SandboxStandardTestRepoGitDir(); + string file = "numbers.txt"; - // The repo - using (var repo = new Repository(path)) - { - Tree rootCommitTree = repo.Lookup("f8d44d7").Tree; - Tree commitTreeWithUpdatedFile = repo.Lookup("ec9e401").Tree; + // The repo + using (var repo = new Repository(path)) + { + Tree rootCommitTree = repo.Lookup("f8d44d7").Tree; + Tree commitTreeWithUpdatedFile = repo.Lookup("ec9e401").Tree; - // Create patch by diffing - using (var patch = repo.Diff.Compare(rootCommitTree, commitTreeWithUpdatedFile)) - { - PatchEntryChanges entryChanges = patch[file]; - Assert.Equal(2, entryChanges.LinesAdded); - Assert.Equal(1, entryChanges.LinesDeleted); - Assert.Equal(187, entryChanges.Patch.Length); - // Smoke test - Assert.Equal(Mode.NonExecutableFile, entryChanges.Mode); - Assert.Equal(new ObjectId("4625a3628cb78970c57e23a2fe2574514ba403c7"), entryChanges.Oid); - Assert.Equal(ChangeKind.Modified, entryChanges.Status); - Assert.Equal(file, entryChanges.OldPath); - Assert.Equal(Mode.NonExecutableFile, entryChanges.OldMode); - Assert.Equal(new ObjectId("7909961ae96accd75b6813d32e0fc1d6d52ec941"), entryChanges.OldOid); + // Create patch by diffing + using (var patch = repo.Diff.Compare(rootCommitTree, commitTreeWithUpdatedFile)) + { + PatchEntryChanges entryChanges = patch[file]; + Assert.Equal(2, entryChanges.LinesAdded); + Assert.Equal(1, entryChanges.LinesDeleted); + Assert.Equal(187, entryChanges.Patch.Length); + // Smoke test + Assert.Equal(Mode.NonExecutableFile, entryChanges.Mode); + Assert.Equal(new ObjectId("4625a3628cb78970c57e23a2fe2574514ba403c7"), entryChanges.Oid); + Assert.Equal(ChangeKind.Modified, entryChanges.Status); + Assert.Equal(file, entryChanges.OldPath); + Assert.Equal(Mode.NonExecutableFile, entryChanges.OldMode); + Assert.Equal(new ObjectId("7909961ae96accd75b6813d32e0fc1d6d52ec941"), entryChanges.OldOid); + } + } } - } } - } } diff --git a/LibGit2Sharp.Tests/RebaseFixture.cs b/LibGit2Sharp.Tests/RebaseFixture.cs index 240ca8985..355e19295 100644 --- a/LibGit2Sharp.Tests/RebaseFixture.cs +++ b/LibGit2Sharp.Tests/RebaseFixture.cs @@ -62,7 +62,7 @@ public void CanRebase(string initialBranchName, RebaseOptions options = new RebaseOptions() { - RebaseStepStarting = x => + RebaseStepStarting = x => { beforeRebaseStepCountCorrect &= beforeStepCallCount == x.StepIndex; totalStepCountCorrect &= (x.TotalStepCount == stepCount); @@ -276,7 +276,7 @@ public void VerifyRebaseDetailed(string attributes, string lineEnding, string[] List rebasedCommits = repo.Commits.QueryBy(commitFilter).ToList(); Assert.Equal(3, rebasedCommits.Count); - for(int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { Assert.Equal(expectedTreeIds[i], rebasedCommits[i].Tree.Id); Assert.Equal(Constants.Signature.Name, rebasedCommits[i].Author.Name); diff --git a/LibGit2Sharp.Tests/RefSpecFixture.cs b/LibGit2Sharp.Tests/RefSpecFixture.cs index 50bf3343b..e0639caa8 100644 --- a/LibGit2Sharp.Tests/RefSpecFixture.cs +++ b/LibGit2Sharp.Tests/RefSpecFixture.cs @@ -83,7 +83,7 @@ public void CanReplaceRefSpecs(string[] newFetchRefSpecs, string[] newPushRefSpe repo.Network.Remotes.Update("origin", r => r.FetchRefSpecs = newFetchRefSpecs, r => r.PushRefSpecs = newPushRefSpecs); - Assert.Equal(oldRefSpecs, remote.RefSpecs.ToList()); + Assert.Equal(oldRefSpecs, remote.RefSpecs.ToList()); } using (var newRemote = repo.Network.Remotes["origin"]) diff --git a/LibGit2Sharp.Tests/ReferenceFixture.cs b/LibGit2Sharp.Tests/ReferenceFixture.cs index ad34d0fb2..b4ec734d5 100644 --- a/LibGit2Sharp.Tests/ReferenceFixture.cs +++ b/LibGit2Sharp.Tests/ReferenceFixture.cs @@ -459,7 +459,7 @@ public void CanUpdateTargetOfADirectReferenceWithAnAbbreviatedSha() Reference master = repo.Refs[masterRef]; Assert.NotEqual(sha, master.ResolveToDirectReference().Target.Sha); - Reference updated = repo.Refs.UpdateTarget(masterRef, sha.Substring(0,4)); + Reference updated = repo.Refs.UpdateTarget(masterRef, sha.Substring(0, 4)); master = repo.Refs[masterRef]; Assert.Equal(updated, master); @@ -556,7 +556,7 @@ public void CanUpdateTargetOfADirectReferenceWithARevparseSpec() const string name = "refs/heads/master"; - var master = (DirectReference) repo.Refs[name]; + var master = (DirectReference)repo.Refs[name]; var @from = master.Target.Id; const string logMessage = "update target message"; diff --git a/LibGit2Sharp.Tests/RemoveFixture.cs b/LibGit2Sharp.Tests/RemoveFixture.cs index 921bc417d..1b74995ca 100644 --- a/LibGit2Sharp.Tests/RemoveFixture.cs +++ b/LibGit2Sharp.Tests/RemoveFixture.cs @@ -28,7 +28,7 @@ public class RemoveFixture : BaseFixture * 'git rm ' fails ("error: '' has local modifications"). */ [InlineData(false, "modified_unstaged_file.txt", false, FileStatus.ModifiedInWorkdir, true, true, FileStatus.NewInWorkdir | FileStatus.DeletedFromIndex)] - [InlineData(true, "modified_unstaged_file.txt", true, FileStatus.ModifiedInWorkdir, true, true, FileStatus.Unaltered)] + [InlineData(true, "modified_unstaged_file.txt", true, FileStatus.ModifiedInWorkdir, true, true, FileStatus.Unaltered)] /*** * Test case: modified file in wd, the modifications have already been promoted to the index. * 'git rm --cached ' works (removes the file from the index) @@ -150,7 +150,7 @@ public void RemovingAnUnknownFileWithLaxExplicitPathsValidationDoesntThrow(strin Commands.Remove(repo, relativePath, i % 2 == 0); Commands.Remove(repo, relativePath, i % 2 == 0, - new ExplicitPathsOptions {ShouldFailOnUnmatchedPath = false}); + new ExplicitPathsOptions { ShouldFailOnUnmatchedPath = false }); } } } @@ -169,7 +169,7 @@ public void RemovingAnUnknownFileThrowsIfExplicitPath(string relativePath, FileS Assert.Equal(status, repo.RetrieveStatus(relativePath)); Assert.Throws( - () => Commands.Remove(repo, relativePath, i%2 == 0, new ExplicitPathsOptions())); + () => Commands.Remove(repo, relativePath, i % 2 == 0, new ExplicitPathsOptions())); } } } diff --git a/LibGit2Sharp.Tests/RepositoryOptionsFixture.cs b/LibGit2Sharp.Tests/RepositoryOptionsFixture.cs index 707e0ecae..46863f44d 100644 --- a/LibGit2Sharp.Tests/RepositoryOptionsFixture.cs +++ b/LibGit2Sharp.Tests/RepositoryOptionsFixture.cs @@ -110,8 +110,8 @@ public void CanProvideADifferentIndexToAStandardRepo() public void OpeningABareRepoWithoutProvidingBothWorkDirAndIndexThrows() { string path = SandboxBareTestRepo(); - Assert.Throws(() => new Repository(path, new RepositoryOptions {IndexPath = newIndex})); - Assert.Throws(() => new Repository(path, new RepositoryOptions {WorkingDirectoryPath = newWorkdir})); + Assert.Throws(() => new Repository(path, new RepositoryOptions { IndexPath = newIndex })); + Assert.Throws(() => new Repository(path, new RepositoryOptions { WorkingDirectoryPath = newWorkdir })); } [Fact] diff --git a/LibGit2Sharp.Tests/ResetHeadFixture.cs b/LibGit2Sharp.Tests/ResetHeadFixture.cs index 83a7efcb9..5fb841ae0 100644 --- a/LibGit2Sharp.Tests/ResetHeadFixture.cs +++ b/LibGit2Sharp.Tests/ResetHeadFixture.cs @@ -94,7 +94,7 @@ private void AssertSoftReset(Func branchIdentifierRetriever, boo { string repoPath = InitNewRepository(); - using (var repo = new Repository(repoPath, new RepositoryOptions{ Identity = Constants.Identity })) + using (var repo = new Repository(repoPath, new RepositoryOptions { Identity = Constants.Identity })) { FeedTheRepository(repo); diff --git a/LibGit2Sharp.Tests/RevertFixture.cs b/LibGit2Sharp.Tests/RevertFixture.cs index b0f12b9dc..c43479f0f 100644 --- a/LibGit2Sharp.Tests/RevertFixture.cs +++ b/LibGit2Sharp.Tests/RevertFixture.cs @@ -157,7 +157,7 @@ public void RevertWithFileConflictStrategyOption(CheckoutFileConflictStrategy co FileConflictStrategy = conflictStrategy, }; - RevertResult result = repo.Revert(repo.Head.Tip.Parents.First(), Constants.Signature, options); + RevertResult result = repo.Revert(repo.Head.Tip.Parents.First(), Constants.Signature, options); Assert.Equal(RevertStatus.Conflicts, result.Status); // Verify there is a conflict. @@ -288,7 +288,7 @@ public void RevertFindsRenames(bool? findRenames) RevertResult result = repo.Revert(commitToRevert, Constants.Signature, options); Assert.NotNull(result); - if(!findRenames.HasValue || + if (!findRenames.HasValue || findRenames.Value == true) { Assert.Equal(RevertStatus.Reverted, result.Status); @@ -340,7 +340,7 @@ public void CanRevertMergeCommit(int mainline, string expectedId) Assert.Equal(RevertStatus.Reverted, result.Status); Assert.Equal(result.Commit.Sha, expectedId); - if(mainline == 1) + if (mainline == 1) { // In this case, we expect "d_renamed.txt" to be reverted (deleted), // and a.txt to match the tip of the "revert" branch. @@ -351,7 +351,7 @@ public void CanRevertMergeCommit(int mainline, string expectedId) Assert.NotNull(commit); Assert.Equal(commit["a.txt"].Target.Id, repo.Index["a.txt"].Id); } - else if(mainline == 2) + else if (mainline == 2) { // In this case, we expect "d_renamed.txt" to be preset, // and a.txt to match the tip of the master branch. @@ -488,7 +488,7 @@ public void RevertWithNothingToRevertInObjectDatabaseSucceeds() [Fact] public void RevertWithConflictReportsConflict() - { + { // The branch name to perform the revert on, // and the file whose contents we expect to be reverted. const string revertBranchName = "refs/heads/revert"; diff --git a/LibGit2Sharp.Tests/SetErrorFixture.cs b/LibGit2Sharp.Tests/SetErrorFixture.cs index e7e1dbed4..35ee15d26 100644 --- a/LibGit2Sharp.Tests/SetErrorFixture.cs +++ b/LibGit2Sharp.Tests/SetErrorFixture.cs @@ -108,7 +108,7 @@ private string IndentString(int level) return new string(' ', level * 4); } -#region ThrowingOdbBackend + #region ThrowingOdbBackend private class ThrowingOdbBackend : OdbBackend { @@ -180,7 +180,7 @@ public override int ForEach(ForEachCallback callback) } } -#endregion + #endregion } } diff --git a/LibGit2Sharp.Tests/StashFixture.cs b/LibGit2Sharp.Tests/StashFixture.cs index 7ba379621..27a535e8e 100644 --- a/LibGit2Sharp.Tests/StashFixture.cs +++ b/LibGit2Sharp.Tests/StashFixture.cs @@ -287,9 +287,9 @@ public void StashFailsWithUncommittedChangesIntheIndex() Touch(repo.Info.WorkingDirectory, filename2, newContents); Assert.Equal(StashApplyStatus.UncommittedChanges, repo.Stashes.Pop(0, new StashApplyOptions - { - ApplyModifiers = StashApplyModifiers.ReinstateIndex, - })); + { + ApplyModifiers = StashApplyModifiers.ReinstateIndex, + })); Assert.Single(repo.Stashes); Assert.Equal(newContents, File.ReadAllText(Path.Combine(repo.Info.WorkingDirectory, filename))); Assert.Equal(newContents, File.ReadAllText(Path.Combine(repo.Info.WorkingDirectory, filename2))); @@ -317,9 +317,9 @@ public void StashCallsTheCallback() called = false; repo.Stashes.Apply(0, new StashApplyOptions - { - ProgressHandler = (progress) => { called = true; return true; } - }); + { + ProgressHandler = (progress) => { called = true; return true; } + }); Assert.True(called); @@ -327,9 +327,9 @@ public void StashCallsTheCallback() called = false; repo.Stashes.Pop(0, new StashApplyOptions - { - ProgressHandler = (progress) => { called = true; return true; } - }); + { + ProgressHandler = (progress) => { called = true; return true; } + }); Assert.True(called); } diff --git a/LibGit2Sharp.Tests/TagFixture.cs b/LibGit2Sharp.Tests/TagFixture.cs index 82a940640..9f125806c 100644 --- a/LibGit2Sharp.Tests/TagFixture.cs +++ b/LibGit2Sharp.Tests/TagFixture.cs @@ -164,7 +164,7 @@ public void CanAddAnAnnotatedTagFromObject() { GitObject obj = repo.Lookup(tagTestSha); - Tag newTag = repo.Tags.Add("unit_test",obj, signatureTim, "a new tag"); + Tag newTag = repo.Tags.Add("unit_test", obj, signatureTim, "a new tag"); Assert.NotNull(newTag); Assert.True(newTag.IsAnnotated); Assert.Equal(tagTestSha, newTag.Target.Sha); diff --git a/LibGit2Sharp.Tests/TreeDefinitionFixture.cs b/LibGit2Sharp.Tests/TreeDefinitionFixture.cs index c31bd588e..99d866c09 100644 --- a/LibGit2Sharp.Tests/TreeDefinitionFixture.cs +++ b/LibGit2Sharp.Tests/TreeDefinitionFixture.cs @@ -67,10 +67,10 @@ public void RequestingAnEntryWithBadParamsThrows() [Theory] [InlineData("1/branch_file.txt", "100755", TreeEntryTargetType.Blob, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057")] - [InlineData("README", "100644", TreeEntryTargetType.Blob, "a8233120f6ad708f843d861ce2b7228ec4e3dec6")] - [InlineData("branch_file.txt", "100644", TreeEntryTargetType.Blob, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057")] - [InlineData("new.txt", "100644", TreeEntryTargetType.Blob, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd")] - [InlineData("1", "040000", TreeEntryTargetType.Tree, "7f76480d939dc401415927ea7ef25c676b8ddb8f")] + [InlineData("README", "100644", TreeEntryTargetType.Blob, "a8233120f6ad708f843d861ce2b7228ec4e3dec6")] + [InlineData("branch_file.txt", "100644", TreeEntryTargetType.Blob, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057")] + [InlineData("new.txt", "100644", TreeEntryTargetType.Blob, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd")] + [InlineData("1", "040000", TreeEntryTargetType.Tree, "7f76480d939dc401415927ea7ef25c676b8ddb8f")] public void CanRetrieveEntries(string path, string expectedAttributes, TreeEntryTargetType expectedType, string expectedSha) { string repoPath = SandboxBareTestRepo(); diff --git a/LibGit2Sharp/AfterRebaseStepInfo.cs b/LibGit2Sharp/AfterRebaseStepInfo.cs index 8e6e78e2d..54558b59d 100644 --- a/LibGit2Sharp/AfterRebaseStepInfo.cs +++ b/LibGit2Sharp/AfterRebaseStepInfo.cs @@ -27,7 +27,7 @@ internal AfterRebaseStepInfo(RebaseStepInfo stepInfo, Commit commit, long comple /// /// internal AfterRebaseStepInfo(RebaseStepInfo stepInfo, long completedStepIndex, long totalStepCount) - : this (stepInfo, null, completedStepIndex, totalStepCount) + : this(stepInfo, null, completedStepIndex, totalStepCount) { WasPatchAlreadyApplied = true; } diff --git a/LibGit2Sharp/BlameHunk.cs b/LibGit2Sharp/BlameHunk.cs index 4feac239d..6350a9bbc 100644 --- a/LibGit2Sharp/BlameHunk.cs +++ b/LibGit2Sharp/BlameHunk.cs @@ -114,8 +114,8 @@ private string DebuggerDisplay return string.Format(CultureInfo.InvariantCulture, "{0}-{1} ({2})", FinalStartLineNumber, - FinalStartLineNumber+LineCount-1, - FinalCommit.ToString().Substring(0,7)); + FinalStartLineNumber + LineCount - 1, + FinalCommit.ToString().Substring(0, 7)); } } diff --git a/LibGit2Sharp/CertificateSsh.cs b/LibGit2Sharp/CertificateSsh.cs index d72b69469..683c04402 100644 --- a/LibGit2Sharp/CertificateSsh.cs +++ b/LibGit2Sharp/CertificateSsh.cs @@ -38,7 +38,7 @@ protected CertificateSsh() internal unsafe CertificateSsh(git_certificate_ssh* cert) { - HasMD5 = cert->type.HasFlag(GitCertificateSshType.MD5); + HasMD5 = cert->type.HasFlag(GitCertificateSshType.MD5); HasSHA1 = cert->type.HasFlag(GitCertificateSshType.SHA1); HashMD5 = new byte[16]; @@ -72,7 +72,7 @@ internal unsafe IntPtr ToPointer() type = sshCertType, }; - fixed (byte *p = &HashMD5[0]) + fixed (byte* p = &HashMD5[0]) { for (var i = 0; i < HashMD5.Length; i++) { @@ -80,7 +80,7 @@ internal unsafe IntPtr ToPointer() } } - fixed (byte *p = &HashSHA1[0]) + fixed (byte* p = &HashSHA1[0]) { for (var i = 0; i < HashSHA1.Length; i++) { diff --git a/LibGit2Sharp/CertificateX509.cs b/LibGit2Sharp/CertificateX509.cs index da45eb43e..7b5b0fac6 100644 --- a/LibGit2Sharp/CertificateX509.cs +++ b/LibGit2Sharp/CertificateX509.cs @@ -23,7 +23,7 @@ protected CertificateX509() internal unsafe CertificateX509(git_certificate_x509* cert) { - int len = checked((int) cert->len.ToUInt32()); + int len = checked((int)cert->len.ToUInt32()); byte[] data = new byte[len]; Marshal.Copy(new IntPtr(cert->data), data, 0, len); Certificate = new X509Certificate(data); @@ -42,7 +42,7 @@ internal unsafe IntPtr ToPointers(out IntPtr dataPtr) var gitCert = new git_certificate_x509() { cert_type = GitCertificateType.X509, - data = (byte*) dataPtr.ToPointer(), + data = (byte*)dataPtr.ToPointer(), len = (UIntPtr)certData.Length, }; diff --git a/LibGit2Sharp/Core/Ensure.cs b/LibGit2Sharp/Core/Ensure.cs index 7adea961a..cd681e4ba 100644 --- a/LibGit2Sharp/Core/Ensure.cs +++ b/LibGit2Sharp/Core/Ensure.cs @@ -49,7 +49,7 @@ public static void ArgumentNotNullOrEmptyString(string argumentValue, string arg { ArgumentNotNull(argumentValue, argumentName); - if (string.IsNullOrWhiteSpace (argumentValue)) + if (string.IsNullOrWhiteSpace(argumentValue)) { throw new ArgumentException("String cannot be empty", argumentName); } @@ -256,7 +256,7 @@ public static void GitObjectIsNotNull(GitObject gitObject, string identifier) } var messageFormat = "No valid git object identified by '{0}' exists in the repository."; - + if (string.Equals("HEAD", identifier, StringComparison.Ordinal)) { throw new UnbornBranchException(messageFormat, identifier); diff --git a/LibGit2Sharp/Core/GitBlame.cs b/LibGit2Sharp/Core/GitBlame.cs index b2683cc73..d484b0b4b 100644 --- a/LibGit2Sharp/Core/GitBlame.cs +++ b/LibGit2Sharp/Core/GitBlame.cs @@ -61,7 +61,7 @@ internal unsafe struct git_blame_hunk public git_oid final_commit_id; public UIntPtr final_start_line_number; public git_signature* final_signature; - + public git_oid orig_commit_id; public char* orig_path; public UIntPtr orig_start_line_number; diff --git a/LibGit2Sharp/Core/GitCertificateSshType.cs b/LibGit2Sharp/Core/GitCertificateSshType.cs index a5151123c..4fc432e9a 100644 --- a/LibGit2Sharp/Core/GitCertificateSshType.cs +++ b/LibGit2Sharp/Core/GitCertificateSshType.cs @@ -5,7 +5,7 @@ namespace LibGit2Sharp.Core [Flags] internal enum GitCertificateSshType { - MD5 = (1 << 0), + MD5 = (1 << 0), SHA1 = (1 << 1), } } diff --git a/LibGit2Sharp/Core/Handles/Objects.cs b/LibGit2Sharp/Core/Handles/Objects.cs index 7666a7412..ddca49bee 100644 --- a/LibGit2Sharp/Core/Handles/Objects.cs +++ b/LibGit2Sharp/Core/Handles/Objects.cs @@ -6,7 +6,7 @@ namespace LibGit2Sharp.Core.Handles internal unsafe class TreeEntryHandle : Libgit2Object { - internal TreeEntryHandle(git_tree_entry *ptr, bool owned) + internal TreeEntryHandle(git_tree_entry* ptr, bool owned) : base(ptr, owned) { } @@ -31,7 +31,7 @@ protected override bool ReleaseHandle() internal unsafe class ReferenceHandle : Libgit2Object { - internal ReferenceHandle(git_reference *ptr, bool owned) + internal ReferenceHandle(git_reference* ptr, bool owned) : base(ptr, owned) { } @@ -56,7 +56,7 @@ protected override bool ReleaseHandle() internal unsafe class RepositoryHandle : Libgit2Object { - internal RepositoryHandle(git_repository *ptr, bool owned) + internal RepositoryHandle(git_repository* ptr, bool owned) : base(ptr, owned) { } @@ -81,7 +81,7 @@ protected override bool ReleaseHandle() internal unsafe class SignatureHandle : Libgit2Object { - internal SignatureHandle(git_signature *ptr, bool owned) + internal SignatureHandle(git_signature* ptr, bool owned) : base(ptr, owned) { } @@ -106,7 +106,7 @@ protected override bool ReleaseHandle() internal unsafe class StatusListHandle : Libgit2Object { - internal StatusListHandle(git_status_list *ptr, bool owned) + internal StatusListHandle(git_status_list* ptr, bool owned) : base(ptr, owned) { } @@ -131,7 +131,7 @@ protected override bool ReleaseHandle() internal unsafe class BlameHandle : Libgit2Object { - internal BlameHandle(git_blame *ptr, bool owned) + internal BlameHandle(git_blame* ptr, bool owned) : base(ptr, owned) { } @@ -156,7 +156,7 @@ protected override bool ReleaseHandle() internal unsafe class DiffHandle : Libgit2Object { - internal DiffHandle(git_diff *ptr, bool owned) + internal DiffHandle(git_diff* ptr, bool owned) : base(ptr, owned) { } @@ -181,7 +181,7 @@ protected override bool ReleaseHandle() internal unsafe class PatchHandle : Libgit2Object { - internal PatchHandle(git_patch *ptr, bool owned) + internal PatchHandle(git_patch* ptr, bool owned) : base(ptr, owned) { } @@ -206,7 +206,7 @@ protected override bool ReleaseHandle() internal unsafe class ConfigurationHandle : Libgit2Object { - internal ConfigurationHandle(git_config *ptr, bool owned) + internal ConfigurationHandle(git_config* ptr, bool owned) : base(ptr, owned) { } @@ -231,7 +231,7 @@ protected override bool ReleaseHandle() internal unsafe class ConflictIteratorHandle : Libgit2Object { - internal ConflictIteratorHandle(git_index_conflict_iterator *ptr, bool owned) + internal ConflictIteratorHandle(git_index_conflict_iterator* ptr, bool owned) : base(ptr, owned) { } @@ -256,7 +256,7 @@ protected override bool ReleaseHandle() internal unsafe class IndexHandle : Libgit2Object { - internal IndexHandle(git_index *ptr, bool owned) + internal IndexHandle(git_index* ptr, bool owned) : base(ptr, owned) { } @@ -281,7 +281,7 @@ protected override bool ReleaseHandle() internal unsafe class ReflogHandle : Libgit2Object { - internal ReflogHandle(git_reflog *ptr, bool owned) + internal ReflogHandle(git_reflog* ptr, bool owned) : base(ptr, owned) { } @@ -306,7 +306,7 @@ protected override bool ReleaseHandle() internal unsafe class TreeBuilderHandle : Libgit2Object { - internal TreeBuilderHandle(git_treebuilder *ptr, bool owned) + internal TreeBuilderHandle(git_treebuilder* ptr, bool owned) : base(ptr, owned) { } @@ -331,7 +331,7 @@ protected override bool ReleaseHandle() internal unsafe class PackBuilderHandle : Libgit2Object { - internal PackBuilderHandle(git_packbuilder *ptr, bool owned) + internal PackBuilderHandle(git_packbuilder* ptr, bool owned) : base(ptr, owned) { } @@ -356,7 +356,7 @@ protected override bool ReleaseHandle() internal unsafe class NoteHandle : Libgit2Object { - internal NoteHandle(git_note *ptr, bool owned) + internal NoteHandle(git_note* ptr, bool owned) : base(ptr, owned) { } @@ -381,7 +381,7 @@ protected override bool ReleaseHandle() internal unsafe class DescribeResultHandle : Libgit2Object { - internal DescribeResultHandle(git_describe_result *ptr, bool owned) + internal DescribeResultHandle(git_describe_result* ptr, bool owned) : base(ptr, owned) { } @@ -406,7 +406,7 @@ protected override bool ReleaseHandle() internal unsafe class SubmoduleHandle : Libgit2Object { - internal SubmoduleHandle(git_submodule *ptr, bool owned) + internal SubmoduleHandle(git_submodule* ptr, bool owned) : base(ptr, owned) { } @@ -431,7 +431,7 @@ protected override bool ReleaseHandle() internal unsafe class AnnotatedCommitHandle : Libgit2Object { - internal AnnotatedCommitHandle(git_annotated_commit *ptr, bool owned) + internal AnnotatedCommitHandle(git_annotated_commit* ptr, bool owned) : base(ptr, owned) { } @@ -456,7 +456,7 @@ protected override bool ReleaseHandle() internal unsafe class ObjectDatabaseHandle : Libgit2Object { - internal ObjectDatabaseHandle(git_odb *ptr, bool owned) + internal ObjectDatabaseHandle(git_odb* ptr, bool owned) : base(ptr, owned) { } @@ -481,7 +481,7 @@ protected override bool ReleaseHandle() internal unsafe class RevWalkerHandle : Libgit2Object { - internal RevWalkerHandle(git_revwalk *ptr, bool owned) + internal RevWalkerHandle(git_revwalk* ptr, bool owned) : base(ptr, owned) { } @@ -506,7 +506,7 @@ protected override bool ReleaseHandle() internal unsafe class RemoteHandle : Libgit2Object { - internal RemoteHandle(git_remote *ptr, bool owned) + internal RemoteHandle(git_remote* ptr, bool owned) : base(ptr, owned) { } @@ -531,7 +531,7 @@ protected override bool ReleaseHandle() internal unsafe class ObjectHandle : Libgit2Object { - internal ObjectHandle(git_object *ptr, bool owned) + internal ObjectHandle(git_object* ptr, bool owned) : base(ptr, owned) { } @@ -556,7 +556,7 @@ protected override bool ReleaseHandle() internal unsafe class RebaseHandle : Libgit2Object { - internal RebaseHandle(git_rebase *ptr, bool owned) + internal RebaseHandle(git_rebase* ptr, bool owned) : base(ptr, owned) { } @@ -581,7 +581,7 @@ protected override bool ReleaseHandle() internal unsafe class OdbStreamHandle : Libgit2Object { - internal OdbStreamHandle(git_odb_stream *ptr, bool owned) + internal OdbStreamHandle(git_odb_stream* ptr, bool owned) : base(ptr, owned) { } @@ -606,7 +606,7 @@ protected override bool ReleaseHandle() internal unsafe class WorktreeHandle : Libgit2Object { - internal WorktreeHandle(git_worktree *ptr, bool owned) + internal WorktreeHandle(git_worktree* ptr, bool owned) : base(ptr, owned) { } diff --git a/LibGit2Sharp/Core/Handles/Objects.tt b/LibGit2Sharp/Core/Handles/Objects.tt index 93707590e..e522bd859 100644 --- a/LibGit2Sharp/Core/Handles/Objects.tt +++ b/LibGit2Sharp/Core/Handles/Objects.tt @@ -72,7 +72,7 @@ for (var i = 0; i < cNames.Length; i++) #> internal unsafe class <#= csNames[i] #> : Libgit2Object { - internal <#= csNames[i] #>(<#= cNames[i] #> *ptr, bool owned) + internal <#= csNames[i] #>(<#= cNames[i] #>* ptr, bool owned) : base(ptr, owned) { } diff --git a/LibGit2Sharp/Core/Opaques.cs b/LibGit2Sharp/Core/Opaques.cs index f5613a276..f83e8be10 100644 --- a/LibGit2Sharp/Core/Opaques.cs +++ b/LibGit2Sharp/Core/Opaques.cs @@ -2,31 +2,31 @@ namespace LibGit2Sharp.Core { - internal struct git_tree_entry {} + internal struct git_tree_entry { } internal struct git_reference { } - internal struct git_refspec {} - internal struct git_repository {} - internal struct git_status_list {} - internal struct git_blame {} - internal struct git_diff {} - internal struct git_patch {} - internal struct git_config {} - internal struct git_index_conflict_iterator {} - internal struct git_index {} - internal struct git_reflog {} - internal struct git_reflog_entry {} - internal struct git_treebuilder {} - internal struct git_packbuilder {} - internal struct git_note {} - internal struct git_describe_result {} - internal struct git_submodule {} - internal struct git_annotated_commit {} - internal struct git_odb {} - internal struct git_revwalk {} - internal struct git_remote {} - internal struct git_object {} - internal struct git_rebase {} - internal struct git_odb_stream {} + internal struct git_refspec { } + internal struct git_repository { } + internal struct git_status_list { } + internal struct git_blame { } + internal struct git_diff { } + internal struct git_patch { } + internal struct git_config { } + internal struct git_index_conflict_iterator { } + internal struct git_index { } + internal struct git_reflog { } + internal struct git_reflog_entry { } + internal struct git_treebuilder { } + internal struct git_packbuilder { } + internal struct git_note { } + internal struct git_describe_result { } + internal struct git_submodule { } + internal struct git_annotated_commit { } + internal struct git_odb { } + internal struct git_revwalk { } + internal struct git_remote { } + internal struct git_object { } + internal struct git_rebase { } + internal struct git_odb_stream { } internal struct git_worktree { } } diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index 18e952e68..cf0a7e3d0 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -274,7 +274,7 @@ public static unsafe RepositoryHandle git_clone( string workdir, ref GitCloneOptions opts) { - git_repository *repo; + git_repository* repo; int res = NativeMethods.git_clone(out repo, url, workdir, ref opts); Ensure.ZeroResult(res); return new RepositoryHandle(repo, true); @@ -347,7 +347,7 @@ public static unsafe string git_commit_create_buffer( handles = parents.Select(c => Proxy.git_object_lookup(c.repo.Handle, c.Id, GitObjectType.Commit)).ToArray(); var ptrs = handles.Select(p => p.AsIntPtr()).ToArray(); int res; - fixed(IntPtr* objs = ptrs) + fixed (IntPtr* objs = ptrs) { res = NativeMethods.git_commit_create_buffer(buf, repo, @@ -497,7 +497,7 @@ public static FilePath git_config_find_programdata() return ConvertPath(NativeMethods.git_config_find_programdata); } - public static unsafe void git_config_free(git_config *config) + public static unsafe void git_config_free(git_config* config) { NativeMethods.git_config_free(config); } @@ -1615,7 +1615,7 @@ public static unsafe ObjectId git_odb_write(ObjectDatabaseHandle odb, byte[] dat { GitOid id; int res; - fixed(byte* p = data) + fixed (byte* p = data) { res = NativeMethods.git_odb_write(out id, odb, p, new UIntPtr((ulong)data.LongLength), type.ToGitObjectType()); } @@ -1624,9 +1624,9 @@ public static unsafe ObjectId git_odb_write(ObjectDatabaseHandle odb, byte[] dat return id; } -#endregion + #endregion -#region git_patch_ + #region git_patch_ public static unsafe PatchHandle git_patch_from_diff(DiffHandle diff, int idx) { @@ -1650,9 +1650,9 @@ public static unsafe Tuple git_patch_line_stats(PatchHandle patch) return new Tuple((int)add, (int)del); } -#endregion + #endregion -#region git_packbuilder_ + #region git_packbuilder_ public static unsafe PackBuilderHandle git_packbuilder_new(RepositoryHandle repo) { @@ -1716,9 +1716,9 @@ public static unsafe UIntPtr git_packbuilder_written(PackBuilderHandle packbuild { return NativeMethods.git_packbuilder_written(packbuilder); } -#endregion + #endregion -#region git_rebase + #region git_rebase public static unsafe RebaseHandle git_rebase_init( RepositoryHandle repo, @@ -1872,9 +1872,9 @@ public static unsafe void git_rebase_finish( } } -#endregion + #endregion -#region git_reference_ + #region git_reference_ public static unsafe ReferenceHandle git_reference_create( RepositoryHandle repo, @@ -2022,9 +2022,9 @@ public static unsafe void git_reference_ensure_log(RepositoryHandle repo, string Ensure.ZeroResult(res); } -#endregion + #endregion -#region git_reflog_ + #region git_reflog_ public static unsafe ReflogHandle git_reflog_read(RepositoryHandle repo, string canonicalName) { @@ -2066,9 +2066,9 @@ public static unsafe string git_reflog_entry_message(git_reflog_entry* entry) return NativeMethods.git_reflog_entry_message(entry); } -#endregion + #endregion -#region git_refspec + #region git_refspec public static unsafe string git_refspec_transform(IntPtr refSpecPtr, string name) { @@ -2127,9 +2127,9 @@ public static bool git_refspec_dst_matches(IntPtr refspec, string reference) return NativeMethods.git_refspec_dst_matches(refspec, reference); } -#endregion + #endregion -#region git_remote_ + #region git_remote_ public static unsafe TagFetchMode git_remote_autotag(RemoteHandle remote) { @@ -2441,9 +2441,9 @@ public static unsafe string git_remote_pushurl(RemoteHandle remote) return NativeMethods.git_remote_pushurl(remote); } -#endregion + #endregion -#region git_repository_ + #region git_repository_ public static FilePath git_repository_discover(FilePath start_path) { @@ -2575,7 +2575,7 @@ public static unsafe RepositoryHandle git_repository_new() public static unsafe void git_repository_open_ext(string path, RepositoryOpenFlags flags, string ceilingDirs) { int res; - git_repository *repo; + git_repository* repo; res = NativeMethods.git_repository_open_ext(out repo, path, flags, ceilingDirs); NativeMethods.git_repository_free(repo); @@ -2652,9 +2652,9 @@ public static unsafe void git_repository_set_head(RepositoryHandle repo, string Ensure.ZeroResult(res); } -#endregion + #endregion -#region git_reset_ + #region git_reset_ public static unsafe void git_reset( RepositoryHandle repo, @@ -2669,9 +2669,9 @@ public static unsafe void git_reset( } } -#endregion + #endregion -#region git_revert_ + #region git_revert_ public static unsafe void git_revert( RepositoryHandle repo, @@ -2741,9 +2741,9 @@ public static ObjectHandle git_revparse_single(RepositoryHandle repo, string obj return handles.Item1; } -#endregion + #endregion -#region git_revwalk_ + #region git_revwalk_ public static unsafe void git_revwalk_hide(RevWalkerHandle walker, ObjectId commit_id) { @@ -2798,9 +2798,9 @@ public static unsafe int git_revwalk_simplify_first_parent(RevWalkerHandle walke return NativeMethods.git_revwalk_simplify_first_parent(walker); } -#endregion + #endregion -#region git_signature_ + #region git_signature_ public static unsafe SignatureHandle git_signature_new(string name, string email, DateTimeOffset when) { @@ -2830,9 +2830,9 @@ public static unsafe SignatureHandle git_signature_now(string name, string email return handle; } -#endregion + #endregion -#region git_stash_ + #region git_stash_ public static unsafe ObjectId git_stash_save( RepositoryHandle repo, @@ -2912,9 +2912,9 @@ public static unsafe StashApplyStatus git_stash_pop( return get_stash_status(NativeMethods.git_stash_pop(repo, (UIntPtr)index, opts)); } -#endregion + #endregion -#region git_status_ + #region git_status_ public static unsafe FileStatus git_status_file(RepositoryHandle repo, FilePath path) { @@ -2960,9 +2960,9 @@ public static unsafe int git_status_list_entrycount(StatusListHandle list) return NativeMethods.git_status_byindex(list, (UIntPtr)idx); } -#endregion + #endregion -#region git_submodule_ + #region git_submodule_ /// /// Returns a handle to the corresponding submodule, @@ -3074,9 +3074,9 @@ public static unsafe void git_submodule_init(SubmoduleHandle submodule, bool ove Ensure.ZeroResult(res); } -#endregion + #endregion -#region git_tag_ + #region git_tag_ public static unsafe ObjectId git_tag_annotation_create( RepositoryHandle repo, @@ -3185,9 +3185,9 @@ public static unsafe GitObjectType git_tag_target_type(ObjectHandle tag) return NativeMethods.git_tag_target_type(tag); } -#endregion + #endregion -#region git_trace_ + #region git_trace_ /// /// Install/Enable logging inside of LibGit2 to send messages back to LibGit2Sharp. @@ -3207,9 +3207,9 @@ public static void git_trace_set(LogLevel level, NativeMethods.git_trace_cb call Ensure.ZeroResult(res); } -#endregion + #endregion -#region git_transport_ + #region git_transport_ public static void git_transport_register(string prefix, IntPtr transport_cb, IntPtr param) { @@ -3236,18 +3236,18 @@ public static void git_transport_unregister(string prefix) Ensure.ZeroResult(res); } -#endregion + #endregion -#region git_transport_smart_ + #region git_transport_smart_ public static int git_transport_smart_credentials(out IntPtr cred, IntPtr transport, string user, int methods) { return NativeMethods.git_transport_smart_credentials(out cred, transport, user, methods); } -#endregion + #endregion -#region git_tree_ + #region git_tree_ public static unsafe Mode git_tree_entry_attributes(git_tree_entry* entry) { @@ -3303,9 +3303,9 @@ public static unsafe int git_tree_entrycount(ObjectHandle tree) return (int)NativeMethods.git_tree_entrycount(tree); } -#endregion + #endregion -#region git_treebuilder_ + #region git_treebuilder_ public static unsafe TreeBuilderHandle git_treebuilder_new(RepositoryHandle repo) { @@ -3333,9 +3333,9 @@ public static unsafe ObjectId git_treebuilder_write(TreeBuilderHandle bld) return oid; } -#endregion + #endregion -#region git_transaction_ + #region git_transaction_ public static void git_transaction_commit(IntPtr txn) { @@ -3347,9 +3347,9 @@ public static void git_transaction_free(IntPtr txn) NativeMethods.git_transaction_free(txn); } -#endregion + #endregion -#region git_libgit2_ + #region git_libgit2_ /// /// Returns the features with which libgit2 was compiled. @@ -3444,10 +3444,10 @@ public static void git_libgit2_opts_enable_strict_hash_verification(bool enabled public static void git_libgit2_opts_set_search_path(ConfigurationLevel level, string path) { int res; - if (isOSXArm64) - res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.SetSearchPath, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, (uint)level, path); - else - res = NativeMethods.git_libgit2_opts((int)LibGit2Option.SetSearchPath, (uint)level, path); + if (isOSXArm64) + res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.SetSearchPath, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, (uint)level, path); + else + res = NativeMethods.git_libgit2_opts((int)LibGit2Option.SetSearchPath, (uint)level, path); Ensure.ZeroResult(res); } @@ -3459,10 +3459,10 @@ public static void git_libgit2_opts_set_enable_caching(bool enabled) { // libgit2 expects non-zero value for true int res; - if (isOSXArm64) - res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.EnableCaching, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, enabled ? 1 : 0); - else - res = NativeMethods.git_libgit2_opts((int)LibGit2Option.EnableCaching, enabled ? 1 : 0); + if (isOSXArm64) + res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.EnableCaching, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, enabled ? 1 : 0); + else + res = NativeMethods.git_libgit2_opts((int)LibGit2Option.EnableCaching, enabled ? 1 : 0); Ensure.ZeroResult(res); } @@ -3474,10 +3474,10 @@ public static void git_libgit2_opts_set_enable_ofsdelta(bool enabled) { // libgit2 expects non-zero value for true int res; - if (isOSXArm64) - res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.EnableOfsDelta, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, enabled ? 1 : 0); - else - res = NativeMethods.git_libgit2_opts((int)LibGit2Option.EnableOfsDelta, enabled ? 1 : 0); + if (isOSXArm64) + res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.EnableOfsDelta, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, enabled ? 1 : 0); + else + res = NativeMethods.git_libgit2_opts((int)LibGit2Option.EnableOfsDelta, enabled ? 1 : 0); Ensure.ZeroResult(res); } @@ -3489,10 +3489,10 @@ public static void git_libgit2_opts_set_enable_strictobjectcreation(bool enabled { // libgit2 expects non-zero value for true int res; - if (isOSXArm64) - res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.EnableStrictObjectCreation, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, enabled ? 1 : 0); - else - res = NativeMethods.git_libgit2_opts((int)LibGit2Option.EnableStrictObjectCreation, enabled ? 1 : 0); + if (isOSXArm64) + res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.EnableStrictObjectCreation, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, enabled ? 1 : 0); + else + res = NativeMethods.git_libgit2_opts((int)LibGit2Option.EnableStrictObjectCreation, enabled ? 1 : 0); Ensure.ZeroResult(res); } @@ -3504,10 +3504,10 @@ public static void git_libgit2_opts_set_enable_strictobjectcreation(bool enabled public static void git_libgit2_opts_set_user_agent(string userAgent) { int res; - if (isOSXArm64) - res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.SetUserAgent, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, userAgent); - else - res = NativeMethods.git_libgit2_opts((int)LibGit2Option.SetUserAgent, userAgent); + if (isOSXArm64) + res = NativeMethods.git_libgit2_opts_osxarm64((int)LibGit2Option.SetUserAgent, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, userAgent); + else + res = NativeMethods.git_libgit2_opts((int)LibGit2Option.SetUserAgent, userAgent); Ensure.ZeroResult(res); } @@ -3635,7 +3635,7 @@ public static unsafe WorktreeLock git_worktree_is_locked(WorktreeHandle worktree { int res = NativeMethods.git_worktree_is_locked(buf, worktree); - if(res < 0) + if (res < 0) { // error return null; diff --git a/LibGit2Sharp/DiffTargets.cs b/LibGit2Sharp/DiffTargets.cs index 58e3f2f4d..40203ee60 100644 --- a/LibGit2Sharp/DiffTargets.cs +++ b/LibGit2Sharp/DiffTargets.cs @@ -18,4 +18,4 @@ public enum DiffTargets /// WorkingDirectory = 2, } -} \ No newline at end of file +} diff --git a/LibGit2Sharp/Filter.cs b/LibGit2Sharp/Filter.cs index 50f5fe8c5..0ab999f19 100644 --- a/LibGit2Sharp/Filter.cs +++ b/LibGit2Sharp/Filter.cs @@ -304,7 +304,7 @@ int StreamCloseCallback(IntPtr stream) { Ensure.ArgumentNotZeroIntPtr(stream, "stream"); - if(!activeStreams.TryGetValue(stream, out state)) + if (!activeStreams.TryGetValue(stream, out state)) { throw new ArgumentException("Unknown stream pointer", nameof(stream)); } diff --git a/LibGit2Sharp/FilterSource.cs b/LibGit2Sharp/FilterSource.cs index ed551aba8..ab1dcb35c 100644 --- a/LibGit2Sharp/FilterSource.cs +++ b/LibGit2Sharp/FilterSource.cs @@ -28,7 +28,7 @@ internal unsafe FilterSource(FilePath path, FilterMode mode, git_filter_source* /// internal static unsafe FilterSource FromNativePtr(IntPtr ptr) { - return FromNativePtr((git_filter_source*) ptr.ToPointer()); + return FromNativePtr((git_filter_source*)ptr.ToPointer()); } /// diff --git a/LibGit2Sharp/IDiffResult.cs b/LibGit2Sharp/IDiffResult.cs index ed6e521fd..5090de88e 100644 --- a/LibGit2Sharp/IDiffResult.cs +++ b/LibGit2Sharp/IDiffResult.cs @@ -5,6 +5,6 @@ namespace LibGit2Sharp /// /// Marker interface to identify Diff results. /// - public interface IDiffResult: IDisposable + public interface IDiffResult : IDisposable { } } diff --git a/LibGit2Sharp/Index.cs b/LibGit2Sharp/Index.cs index 46d756e04..321673606 100644 --- a/LibGit2Sharp/Index.cs +++ b/LibGit2Sharp/Index.cs @@ -247,7 +247,7 @@ private unsafe void AddEntryToTheIndex(string path, ObjectId id, Mode mode) var indexEntry = new git_index_entry { mode = (uint)mode, - path = (char*) pathPtr, + path = (char*)pathPtr, }; Marshal.Copy(id.RawId, 0, new IntPtr(indexEntry.id.Id), GitOid.Size); diff --git a/LibGit2Sharp/IndexReucEntryCollection.cs b/LibGit2Sharp/IndexReucEntryCollection.cs index 61af48b18..818bce70c 100644 --- a/LibGit2Sharp/IndexReucEntryCollection.cs +++ b/LibGit2Sharp/IndexReucEntryCollection.cs @@ -40,7 +40,7 @@ public virtual unsafe IndexReucEntry this[string path] } } - private unsafe IndexReucEntry this[int idx] + private unsafe IndexReucEntry this[int idx] { get { diff --git a/LibGit2Sharp/ObjectId.cs b/LibGit2Sharp/ObjectId.cs index ad61cba36..d87bbcb34 100644 --- a/LibGit2Sharp/ObjectId.cs +++ b/LibGit2Sharp/ObjectId.cs @@ -59,7 +59,7 @@ public ObjectId(byte[] rawId) internal static unsafe ObjectId BuildFromPtr(IntPtr ptr) { - return BuildFromPtr((git_oid*) ptr.ToPointer()); + return BuildFromPtr((git_oid*)ptr.ToPointer()); } internal static unsafe ObjectId BuildFromPtr(git_oid* id) @@ -71,7 +71,7 @@ internal unsafe ObjectId(byte* rawId) { byte[] id = new byte[GitOid.Size]; - fixed(byte* p = id) + fixed (byte* p = id) { for (int i = 0; i < rawSize; i++) { diff --git a/LibGit2Sharp/Rebase.cs b/LibGit2Sharp/Rebase.cs index 00dc3f267..c573ffa65 100644 --- a/LibGit2Sharp/Rebase.cs +++ b/LibGit2Sharp/Rebase.cs @@ -88,7 +88,7 @@ public virtual RebaseResult Start(Branch branch, Branch upstream, Branch onto, I if (this.repository.Info.CurrentOperation != CurrentOperation.None) { - throw new LibGit2SharpException("A {0} operation is already in progress.", + throw new LibGit2SharpException("A {0} operation is already in progress.", this.repository.Info.CurrentOperation); } diff --git a/LibGit2Sharp/RefSpec.cs b/LibGit2Sharp/RefSpec.cs index 5819820eb..4d9e28fbe 100644 --- a/LibGit2Sharp/RefSpec.cs +++ b/LibGit2Sharp/RefSpec.cs @@ -13,9 +13,9 @@ namespace LibGit2Sharp public class RefSpec { // This is here to keep the pointer alive - #pragma warning disable 0414 +#pragma warning disable 0414 readonly Remote remote; - #pragma warning restore 0414 +#pragma warning restore 0414 readonly IntPtr handle; internal unsafe RefSpec(Remote remote, git_refspec* handle) diff --git a/LibGit2Sharp/RefSpecCollection.cs b/LibGit2Sharp/RefSpecCollection.cs index 6ba813e47..a35710719 100644 --- a/LibGit2Sharp/RefSpecCollection.cs +++ b/LibGit2Sharp/RefSpecCollection.cs @@ -16,10 +16,10 @@ namespace LibGit2Sharp public class RefSpecCollection : IEnumerable { // These are here to keep the pointer alive - #pragma warning disable 0414 +#pragma warning disable 0414 readonly Remote remote; readonly RemoteHandle handle; - #pragma warning restore 0414 +#pragma warning restore 0414 readonly Lazy> refspecs; /// diff --git a/LibGit2Sharp/ReferenceCollection.cs b/LibGit2Sharp/ReferenceCollection.cs index 456b1a043..92bf85426 100644 --- a/LibGit2Sharp/ReferenceCollection.cs +++ b/LibGit2Sharp/ReferenceCollection.cs @@ -404,7 +404,7 @@ public virtual Reference Rename(string currentName, string newName, if (reference == null) { - throw new LibGit2SharpException("Reference '{0}' doesn't exist. One cannot move a non existing reference.", + throw new LibGit2SharpException("Reference '{0}' doesn't exist. One cannot move a non existing reference.", currentName); } diff --git a/LibGit2Sharp/Remote.cs b/LibGit2Sharp/Remote.cs index 3bf957866..401a7ddd0 100644 --- a/LibGit2Sharp/Remote.cs +++ b/LibGit2Sharp/Remote.cs @@ -83,7 +83,8 @@ public virtual string Name /// public virtual string Url { - get { return Proxy.git_remote_url(handle); } } + get { return Proxy.git_remote_url(handle); } + } /// /// Gets the distinct push url for this remote repository, if set. diff --git a/LibGit2Sharp/RemoteCallbacks.cs b/LibGit2Sharp/RemoteCallbacks.cs index ce5dccf81..6061b10e1 100644 --- a/LibGit2Sharp/RemoteCallbacks.cs +++ b/LibGit2Sharp/RemoteCallbacks.cs @@ -310,10 +310,10 @@ private unsafe int GitCertificateCheck(git_certificate* certPtr, int valid, IntP switch (certPtr->type) { case GitCertificateType.X509: - cert = new CertificateX509((git_certificate_x509*) certPtr); + cert = new CertificateX509((git_certificate_x509*)certPtr); break; case GitCertificateType.Hostkey: - cert = new CertificateSsh((git_certificate_ssh*) certPtr); + cert = new CertificateSsh((git_certificate_ssh*)certPtr); break; } @@ -355,7 +355,7 @@ private int GitPushNegotiationHandler(IntPtr updates, UIntPtr len, IntPtr payloa throw new NullReferenceException("Unexpected null git_push_update pointer was encountered"); } - PushUpdate pushUpdate = new PushUpdate((git_push_update*) ptr[i].ToPointer()); + PushUpdate pushUpdate = new PushUpdate((git_push_update*)ptr[i].ToPointer()); pushUpdates[i] = pushUpdate; } diff --git a/LibGit2Sharp/RemoteCollection.cs b/LibGit2Sharp/RemoteCollection.cs index 634f6e770..45e71c8b2 100644 --- a/LibGit2Sharp/RemoteCollection.cs +++ b/LibGit2Sharp/RemoteCollection.cs @@ -58,7 +58,8 @@ public virtual void Update(string remote, params Action[] actions { var updater = new RemoteUpdater(repository, remote); - repository.Config.WithinTransaction(() => { + repository.Config.WithinTransaction(() => + { foreach (Action action in actions) { action(updater); diff --git a/LibGit2Sharp/RepositoryExtensions.cs b/LibGit2Sharp/RepositoryExtensions.cs index edeb6b93f..5d0788c8a 100644 --- a/LibGit2Sharp/RepositoryExtensions.cs +++ b/LibGit2Sharp/RepositoryExtensions.cs @@ -24,7 +24,7 @@ public static T Lookup(this IRepository repository, string objectish) where T { EnsureNoGitLink(); - if (typeof (T) == typeof (GitObject)) + if (typeof(T) == typeof(GitObject)) { return (T)repository.Lookup(objectish); } diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs index 490dc6798..cc1c6e7e0 100644 --- a/LibGit2Sharp/RepositoryStatus.cs +++ b/LibGit2Sharp/RepositoryStatus.cs @@ -64,7 +64,7 @@ internal unsafe RepositoryStatus(Repository repo, StatusOptions options) for (int i = 0; i < count; i++) { - git_status_entry *entry = Proxy.git_status_byindex(list, i); + git_status_entry* entry = Proxy.git_status_byindex(list, i); AddStatusEntryForDelta(entry->status, entry->head_to_index, entry->index_to_workdir); } diff --git a/LibGit2Sharp/RevertResult.cs b/LibGit2Sharp/RevertResult.cs index da54046a4..8f9a270d3 100644 --- a/LibGit2Sharp/RevertResult.cs +++ b/LibGit2Sharp/RevertResult.cs @@ -34,7 +34,7 @@ internal RevertResult(RevertStatus status, Commit commit = null) public virtual RevertStatus Status { get; private set; } } - /// + /// /// The status of what happened as a result of a revert. /// public enum RevertStatus diff --git a/LibGit2Sharp/SimilarityOptions.cs b/LibGit2Sharp/SimilarityOptions.cs index 13d26abf2..4d2b0cd95 100644 --- a/LibGit2Sharp/SimilarityOptions.cs +++ b/LibGit2Sharp/SimilarityOptions.cs @@ -81,7 +81,7 @@ public SimilarityOptions() /// public static SimilarityOptions None { - get { return new SimilarityOptions {RenameDetectionMode = RenameDetectionMode.None}; } + get { return new SimilarityOptions { RenameDetectionMode = RenameDetectionMode.None }; } } /// @@ -89,7 +89,7 @@ public static SimilarityOptions None /// public static SimilarityOptions Renames { - get { return new SimilarityOptions {RenameDetectionMode = RenameDetectionMode.Renames}; } + get { return new SimilarityOptions { RenameDetectionMode = RenameDetectionMode.Renames }; } } /// @@ -97,7 +97,7 @@ public static SimilarityOptions Renames /// public static SimilarityOptions Exact { - get { return new SimilarityOptions {RenameDetectionMode = RenameDetectionMode.Exact}; } + get { return new SimilarityOptions { RenameDetectionMode = RenameDetectionMode.Exact }; } } /// @@ -105,7 +105,7 @@ public static SimilarityOptions Exact /// public static SimilarityOptions Copies { - get { return new SimilarityOptions {RenameDetectionMode = RenameDetectionMode.Copies}; } + get { return new SimilarityOptions { RenameDetectionMode = RenameDetectionMode.Copies }; } } /// @@ -113,7 +113,7 @@ public static SimilarityOptions Copies /// public static SimilarityOptions CopiesHarder { - get { return new SimilarityOptions {RenameDetectionMode = RenameDetectionMode.CopiesHarder}; } + get { return new SimilarityOptions { RenameDetectionMode = RenameDetectionMode.CopiesHarder }; } } /// @@ -121,7 +121,7 @@ public static SimilarityOptions CopiesHarder /// public static SimilarityOptions Default { - get { return new SimilarityOptions {RenameDetectionMode = RenameDetectionMode.Default}; } + get { return new SimilarityOptions { RenameDetectionMode = RenameDetectionMode.Default }; } } /// diff --git a/LibGit2Sharp/SmartSubtransport.cs b/LibGit2Sharp/SmartSubtransport.cs index e7a331b4b..6160c849b 100644 --- a/LibGit2Sharp/SmartSubtransport.cs +++ b/LibGit2Sharp/SmartSubtransport.cs @@ -73,7 +73,9 @@ public int CertificateCheck(Certificate cert, bool valid, string hostname) var certPtr = sshCert.ToPointer(); ret = NativeMethods.git_transport_smart_certificate_check(Transport, certPtr, valid ? 1 : 0, hostname); Marshal.FreeHGlobal(certPtr); - } else { + } + else + { IntPtr certPtr, dataPtr; certPtr = x509Cert.ToPointers(out dataPtr); ret = NativeMethods.git_transport_smart_certificate_check(Transport, certPtr, valid ? 1 : 0, hostname); @@ -131,11 +133,11 @@ public int AcquireCredentials(out Credentials cred, string user, params Type[] m unsafe { - var baseCred = (GitCredential*) credHandle; + var baseCred = (GitCredential*)credHandle; switch (baseCred->credtype) { case GitCredentialType.UserPassPlaintext: - cred = UsernamePasswordCredentials.FromNative((GitCredentialUserpass*) credHandle); + cred = UsernamePasswordCredentials.FromNative((GitCredentialUserpass*)credHandle); return 0; case GitCredentialType.Default: cred = new DefaultCredentials(); diff --git a/LibGit2Sharp/TagCollection.cs b/LibGit2Sharp/TagCollection.cs index 8bd9168b0..98bfd257d 100644 --- a/LibGit2Sharp/TagCollection.cs +++ b/LibGit2Sharp/TagCollection.cs @@ -114,7 +114,7 @@ public virtual Tag Add(string name, string objectish) /// The name. /// Revparse spec for the target object. /// True to allow silent overwriting a potentially existing tag, false otherwise. - public virtual Tag Add( string name, string objectish, bool allowOverwrite) + public virtual Tag Add(string name, string objectish, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(objectish, "objectish"); diff --git a/LibGit2Sharp/TransientIndex.cs b/LibGit2Sharp/TransientIndex.cs index 65b7b7872..b62678c83 100644 --- a/LibGit2Sharp/TransientIndex.cs +++ b/LibGit2Sharp/TransientIndex.cs @@ -7,7 +7,7 @@ namespace LibGit2Sharp /// An implementation of with disposal managed by the caller /// (instead of automatically disposing when the repository is disposed) /// - public class TransientIndex: Index, IDisposable + public class TransientIndex : Index, IDisposable { /// /// Needed for mocking purposes. diff --git a/LibGit2Sharp/Tree.cs b/LibGit2Sharp/Tree.cs index 64d46145d..30f534a99 100644 --- a/LibGit2Sharp/Tree.cs +++ b/LibGit2Sharp/Tree.cs @@ -110,7 +110,8 @@ public virtual IEnumerator GetEnumerator() { using (var obj = new ObjectSafeWrapper(Id, repo.Handle, throwIfMissing: true)) { - for (uint i = 0; i < Count; i++) { + for (uint i = 0; i < Count; i++) + { yield return byIndex(obj, i, Id, repo, path); } } diff --git a/LibGit2Sharp/Worktree.cs b/LibGit2Sharp/Worktree.cs index bd10f6110..ca7f5ef16 100644 --- a/LibGit2Sharp/Worktree.cs +++ b/LibGit2Sharp/Worktree.cs @@ -95,7 +95,7 @@ public virtual void Unlock() this.worktreeLock = Proxy.git_worktree_is_locked(handle); } } - + /// /// Lock the worktree /// diff --git a/LibGit2Sharp/WorktreeCollection.cs b/LibGit2Sharp/WorktreeCollection.cs index 9822e882c..7bdd5fefa 100644 --- a/LibGit2Sharp/WorktreeCollection.cs +++ b/LibGit2Sharp/WorktreeCollection.cs @@ -57,7 +57,7 @@ public virtual Worktree this[string name] /// public virtual Worktree Add(string committishOrBranchSpec, string name, string path, bool isLocked) { - if(string.Equals(committishOrBranchSpec, name)) + if (string.Equals(committishOrBranchSpec, name)) { // Proxy.git_worktree_add() creates a new branch of name = name, so if we want to checkout a given branch then the 'name' cannot be the same as the target branch return null; @@ -83,9 +83,9 @@ public virtual Worktree Add(string committishOrBranchSpec, string name, string p } } - - return this[name]; + + return this[name]; } ///