Permalink
Browse files

Enforce code style

  • Loading branch information...
1 parent 75ae7f9 commit df04d9d21aad672241f4c995a217fc1f473ab818 @nulltoken committed Sep 15, 2011
Showing with 787 additions and 719 deletions.
  1. +5 −5 LibGit2Sharp.Tests/BlobFixture.cs
  2. +25 −25 LibGit2Sharp.Tests/BranchFixture.cs
  3. +20 −20 LibGit2Sharp.Tests/CommitFixture.cs
  4. +10 −10 LibGit2Sharp.Tests/EpochFixture.cs
  5. +13 −13 LibGit2Sharp.Tests/IndexFixture.cs
  6. +3 −3 LibGit2Sharp.Tests/LazyFixture.cs
  7. +1 −1 LibGit2Sharp.Tests/ObjectIdFixture.cs
  8. +1 −1 LibGit2Sharp.Tests/Properties/AssemblyInfo.cs
  9. +27 −24 LibGit2Sharp.Tests/ReferenceFixture.cs
  10. +16 −17 LibGit2Sharp.Tests/RepositoryFixture.cs
  11. +41 −42 LibGit2Sharp.Tests/TagFixture.cs
  12. +1 −1 LibGit2Sharp.Tests/TestHelpers/AssertExtensions.cs
  13. +1 −3 LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
  14. +2 −2 LibGit2Sharp.Tests/TestHelpers/Constants.cs
  15. +7 −3 LibGit2Sharp.Tests/TestHelpers/DirectoryHelper.cs
  16. +1 −2 LibGit2Sharp.Tests/TestHelpers/SelfCleaningDirectory.cs
  17. +1 −1 LibGit2Sharp.Tests/TestHelpers/SignatureExtensions.cs
  18. +1 −1 LibGit2Sharp.Tests/TestHelpers/TemporaryCloneOfTestRepo.cs
  19. +3 −3 LibGit2Sharp.Tests/TreeFixture.cs
  20. +5 −2 LibGit2Sharp/AbbreviatedObjectId.cs
  21. +2 −2 LibGit2Sharp/Blob.cs
  22. +14 −11 LibGit2Sharp/Branch.cs
  23. +11 −11 LibGit2Sharp/BranchCollection.cs
  24. +20 −14 LibGit2Sharp/Commit.cs
  25. +31 −30 LibGit2Sharp/CommitCollection.cs
  26. +9 −9 LibGit2Sharp/Core/Ensure.cs
  27. +12 −12 LibGit2Sharp/Core/Epoch.cs
  28. +35 −35 LibGit2Sharp/Core/GitErrorCode.cs
  29. +1 −1 LibGit2Sharp/Core/GitIndexEntry.cs
  30. +1 −1 LibGit2Sharp/Core/GitIndexTime.cs
  31. +1 −1 LibGit2Sharp/Core/GitObjectTypeMap.cs
  32. +1 −1 LibGit2Sharp/Core/GitOid.cs
  33. +1 −1 LibGit2Sharp/Core/GitReferenceType.cs
  34. +1 −1 LibGit2Sharp/Core/GitRepositoryPathId.cs
  35. +1 −1 LibGit2Sharp/Core/GitSignature.cs
  36. +1 −1 LibGit2Sharp/Core/GitTime.cs
  37. +1 −1 LibGit2Sharp/Core/IndexSafeHandle.cs
  38. +1 −1 LibGit2Sharp/Core/IntPtrExtensions.cs
  39. +3 −3 LibGit2Sharp/Core/LambdaEqualityHelper.cs
  40. +10 −7 LibGit2Sharp/Core/Lazy.cs
  41. +3 −3 LibGit2Sharp/Core/Libgit2UnsafeHelper.cs
  42. +52 −53 LibGit2Sharp/Core/NativeMethods.cs
  43. +3 −3 LibGit2Sharp/Core/ObjectSafeWrapper.cs
  44. +2 −2 LibGit2Sharp/Core/PosixPathHelper.cs
  45. +1 −1 LibGit2Sharp/Core/RepositorySafeHandle.cs
  46. +1 −1 LibGit2Sharp/Core/RevWalkerSafeHandle.cs
  47. +1 −1 LibGit2Sharp/Core/SafeHandleBase.cs
  48. +1 −1 LibGit2Sharp/Core/UnSafeNativeMethods.cs
  49. +19 −13 LibGit2Sharp/Core/{UTF8Marshaler.cs → Utf8Marshaler.cs}
  50. +6 −3 LibGit2Sharp/DirectReference.cs
  51. +20 −21 LibGit2Sharp/Filter.cs
  52. +24 −24 LibGit2Sharp/GitObject.cs
  53. +12 −12 LibGit2Sharp/GitObjectType.cs
  54. +13 −13 LibGit2Sharp/GitSortOptions.cs
  55. +2 −2 LibGit2Sharp/ICommitCollection.cs
  56. +8 −8 LibGit2Sharp/IQueryableCommitCollection.cs
  57. +15 −15 LibGit2Sharp/Index.cs
  58. +2 −2 LibGit2Sharp/IndexEntry.cs
  59. +1 −1 LibGit2Sharp/IndexEntryState.cs
  60. +1 −1 LibGit2Sharp/LibGit2Sharp.csproj
  61. +39 −36 LibGit2Sharp/ObjectId.cs
  62. +1 −1 LibGit2Sharp/Properties/AssemblyInfo.cs
  63. +25 −24 LibGit2Sharp/Reference.cs
  64. +23 −17 LibGit2Sharp/ReferenceCollection.cs
  65. +32 −27 LibGit2Sharp/Repository.cs
  66. +35 −35 LibGit2Sharp/RepositoryExtensions.cs
  67. +3 −3 LibGit2Sharp/RepositoryInformation.cs
  68. +2 −2 LibGit2Sharp/Signature.cs
  69. +2 −2 LibGit2Sharp/SymbolicReference.cs
  70. +36 −26 LibGit2Sharp/Tag.cs
  71. +7 −4 LibGit2Sharp/TagAnnotation.cs
  72. +9 −12 LibGit2Sharp/TagCollection.cs
  73. +5 −5 LibGit2Sharp/Tree.cs
  74. +24 −21 LibGit2Sharp/TreeEntry.cs
  75. +16 −1 ResharperSettings.xml
@@ -15,7 +15,7 @@ public void CanGetBlobAsUtf8()
{
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
- var text = blob.ContentAsUtf8();
+ string text = blob.ContentAsUtf8();
text.ShouldEqual("hey there\n");
}
}
@@ -46,10 +46,10 @@ public void CanReadBlobContent()
using (var repo = new Repository(Constants.BareTestRepoPath))
{
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
- var bytes = blob.Content;
+ byte[] bytes = blob.Content;
bytes.Length.ShouldEqual(10);
- var content = Encoding.UTF8.GetString(bytes);
+ string content = Encoding.UTF8.GetString(bytes);
content.ShouldEqual("hey there\n");
}
}
@@ -63,10 +63,10 @@ public void CanReadBlobStream()
using (var tr = new StreamReader(blob.ContentStream, Encoding.UTF8))
{
- var content = tr.ReadToEnd();
+ string content = tr.ReadToEnd();
content.ShouldEqual("hey there\n");
}
}
}
}
-}
+}
@@ -9,18 +9,18 @@ namespace LibGit2Sharp.Tests
[TestFixture]
public class BranchFixture : BaseFixture
{
- private readonly List<string> expectedBranches = new List<string> {"packed-test", "packed", "br2", "master", "test", "deadbeef"};
+ private readonly List<string> expectedBranches = new List<string> { "packed-test", "packed", "br2", "master", "test", "deadbeef" };
[Test]
public void CanCheckoutAnExistingBranch()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
- var master = repo.Branches["master"];
+ Branch master = repo.Branches["master"];
master.IsCurrentRepositoryHead.ShouldBeTrue();
- var test = repo.Branches.Checkout("test");
+ Branch test = repo.Branches.Checkout("test");
test.IsCurrentRepositoryHead.ShouldBeTrue();
master.IsCurrentRepositoryHead.ShouldBeFalse();
@@ -34,7 +34,7 @@ public void CanCreateBranch()
using (var repo = new Repository(path.RepositoryPath))
{
const string name = "unit_test";
- var newBranch = repo.CreateBranch(name, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
+ Branch newBranch = repo.CreateBranch(name, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
newBranch.ShouldNotBeNull();
newBranch.Name.ShouldEqual(name);
newBranch.CanonicalName.ShouldEqual("refs/heads/" + name);
@@ -53,7 +53,7 @@ public void CanCreateBranchUsingAbbreviatedSha()
using (var repo = new Repository(path.RepositoryPath))
{
const string name = "unit_test";
- var newBranch = repo.CreateBranch(name, "be3563a");
+ Branch newBranch = repo.CreateBranch(name, "be3563a");
newBranch.CanonicalName.ShouldEqual("refs/heads/" + name);
newBranch.Tip.Sha.ShouldEqual("be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
}
@@ -66,7 +66,7 @@ public void CanCreateBranchFromImplicitHead()
using (var repo = new Repository(path.RepositoryPath))
{
const string name = "unit_test";
- var newBranch = repo.CreateBranch(name);
+ Branch newBranch = repo.CreateBranch(name);
newBranch.ShouldNotBeNull();
newBranch.Name.ShouldEqual(name);
newBranch.CanonicalName.ShouldEqual("refs/heads/" + name);
@@ -85,7 +85,7 @@ public void CanCreateBranchFromExplicitHead()
using (var repo = new Repository(path.RepositoryPath))
{
const string name = "unit_test";
- var newBranch = repo.CreateBranch(name, "HEAD");
+ Branch newBranch = repo.CreateBranch(name, "HEAD");
newBranch.ShouldNotBeNull();
newBranch.Tip.Sha.ShouldEqual("4c062a6361ae6959e06292c1fa5e2822d9c96345");
}
@@ -96,7 +96,7 @@ public void CanListAllBranches()
{
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- foreach (var r in repo.Branches)
+ foreach (Branch r in repo.Branches)
{
Assert.Contains(r.Name, expectedBranches);
}
@@ -110,11 +110,11 @@ public void CanLookupABranchByItsCanonicalName()
{
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- var branch = repo.Branches["refs/heads/br2"];
+ Branch branch = repo.Branches["refs/heads/br2"];
branch.ShouldNotBeNull();
branch.Name.ShouldEqual("br2");
- var branch2 = repo.Branches["refs/heads/br2"];
+ Branch branch2 = repo.Branches["refs/heads/br2"];
branch2.ShouldNotBeNull();
branch2.Name.ShouldEqual("br2");
@@ -128,7 +128,7 @@ public void CanLookupLocalBranch()
{
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- var master = repo.Branches["master"];
+ Branch master = repo.Branches["master"];
master.ShouldNotBeNull();
master.IsRemote.ShouldBeFalse();
master.Name.ShouldEqual("master");
@@ -143,7 +143,7 @@ public void CanWalkCommitsFromAnotherBranch()
{
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- var master = repo.Branches["test"];
+ Branch master = repo.Branches["test"];
master.Commits.Count().ShouldEqual(2);
}
}
@@ -153,7 +153,7 @@ public void CanWalkCommitsFromBranch()
{
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- var master = repo.Branches["master"];
+ Branch master = repo.Branches["master"];
master.Commits.Count().ShouldEqual(7);
}
}
@@ -243,7 +243,7 @@ public void OnlyOneBranchIsTheHead()
{
Branch head = null;
- foreach (var branch in repo.Branches)
+ foreach (Branch branch in repo.Branches)
{
bool isHead = branch.IsCurrentRepositoryHead;
@@ -271,9 +271,9 @@ public void TwoBranchesPointingAtTheSameCommitAreNotBothCurrent()
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
- var master = repo.Branches["refs/heads/master"];
+ Branch master = repo.Branches["refs/heads/master"];
- var newBranch = repo.Branches.Create("clone-of-master", master.Tip.Sha);
+ Branch newBranch = repo.Branches.Create("clone-of-master", master.Tip.Sha);
newBranch.IsCurrentRepositoryHead.ShouldBeFalse();
}
}
@@ -286,7 +286,7 @@ public void CanMoveABranch()
{
repo.Branches["br3"].ShouldBeNull();
- var newBranch = repo.Branches.Move("br2", "br3");
+ Branch newBranch = repo.Branches.Move("br2", "br3");
newBranch.Name.ShouldEqual("br3");
repo.Branches["br2"].ShouldBeNull();
@@ -310,18 +310,18 @@ public void CanMoveABranchWhileOverwritingAnExistingOne()
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
- var test = repo.Branches["test"];
+ Branch test = repo.Branches["test"];
test.ShouldNotBeNull();
- var br2 = repo.Branches["br2"];
+ Branch br2 = repo.Branches["br2"];
br2.ShouldNotBeNull();
- var newBranch = repo.Branches.Move("br2", "test", true);
+ Branch newBranch = repo.Branches.Move("br2", "test", true);
newBranch.Name.ShouldEqual("test");
repo.Branches["br2"].ShouldBeNull();
- var newTest = repo.Branches["test"];
+ Branch newTest = repo.Branches["test"];
newTest.ShouldNotBeNull();
newTest.ShouldEqual(newBranch);
@@ -335,15 +335,15 @@ public void CreatingABranchTriggersTheCreationOfADirectReference()
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
- var newBranch = repo.CreateBranch("clone-of-master");
+ Branch newBranch = repo.CreateBranch("clone-of-master");
newBranch.IsCurrentRepositoryHead.ShouldBeFalse();
- var commitId = repo.Head.Tip.Id;
+ ObjectId commitId = repo.Head.Tip.Id;
newBranch.Tip.Id.ShouldEqual(commitId);
- var reference = repo.Refs[newBranch.CanonicalName];
+ Reference reference = repo.Refs[newBranch.CanonicalName];
reference.ShouldNotBeNull();
- Assert.IsInstanceOf(typeof (DirectReference), reference);
+ Assert.IsInstanceOf(typeof(DirectReference), reference);
}
}
}
@@ -44,7 +44,7 @@ public void CanEnumerateCommits()
int count = 0;
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- foreach (var commit in repo.Commits)
+ foreach (Commit commit in repo.Commits)
{
commit.ShouldNotBeNull();
count++;
@@ -59,7 +59,7 @@ public void CanEnumerateCommitsInDetachedHeadState()
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
- var parentOfHead = repo.Head.Tip.Parents.First().Id;
+ ObjectId parentOfHead = repo.Head.Tip.Parents.First().Id;
repo.Refs.Create("HEAD", parentOfHead.Sha, true);
Assert.AreEqual(true, repo.Info.IsHeadDetached);
@@ -83,7 +83,7 @@ public void CanEnumerateCommitsFromSha()
int count = 0;
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- foreach (var commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" }))
+ foreach (Commit commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" }))
{
commit.ShouldNotBeNull();
count++;
@@ -134,7 +134,7 @@ public void CanEnumerateCommitsWithReverseTimeSorting()
int count = 0;
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- foreach (var commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time | GitSortOptions.Reverse }))
+ foreach (Commit commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time | GitSortOptions.Reverse }))
{
commit.ShouldNotBeNull();
commit.Sha.StartsWith(expectedShas[count]);
@@ -149,13 +149,13 @@ public void CanEnumerateCommitsWithReverseTopoSorting()
{
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- var commits = repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time | GitSortOptions.Reverse }).ToList();
- foreach (var commit in commits)
+ List<Commit> commits = repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time | GitSortOptions.Reverse }).ToList();
+ foreach (Commit commit in commits)
{
commit.ShouldNotBeNull();
- foreach (var p in commit.Parents)
+ foreach (Commit p in commit.Parents)
{
- var parent = commits.Single(x => x.Id == p.Id);
+ Commit parent = commits.Single(x => x.Id == p.Id);
Assert.Greater(commits.IndexOf(commit), commits.IndexOf(parent));
}
}
@@ -168,7 +168,7 @@ public void CanEnumerateCommitsWithTimeSorting()
int count = 0;
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- foreach (var commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time }))
+ foreach (Commit commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time }))
{
commit.ShouldNotBeNull();
commit.Sha.StartsWith(expectedShas[count]);
@@ -183,13 +183,13 @@ public void CanEnumerateCommitsWithTopoSorting()
{
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- var commits = repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Topological }).ToList();
- foreach (var commit in commits)
+ List<Commit> commits = repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Topological }).ToList();
+ foreach (Commit commit in commits)
{
commit.ShouldNotBeNull();
- foreach (var p in commit.Parents)
+ foreach (Commit p in commit.Parents)
{
- var parent = commits.Single(x => x.Id == p.Id);
+ Commit parent = commits.Single(x => x.Id == p.Id);
Assert.Less(commits.IndexOf(commit), commits.IndexOf(parent));
}
}
@@ -285,7 +285,7 @@ private static void AssertEnumerationOfCommits(Func<Repository, Filter> filterBu
{
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- var commits = repo.Commits.QueryBy(filterBuilder(repo));
+ ICommitCollection commits = repo.Commits.QueryBy(filterBuilder(repo));
IEnumerable<string> commitShas = commits.Select(c => c.Id.ToString(7)).ToArray();
@@ -310,7 +310,7 @@ public void CanReadCommitData()
{
using (var repo = new Repository(Constants.BareTestRepoPath))
{
- var obj = repo.Lookup(sha);
+ GitObject obj = repo.Lookup(sha);
obj.ShouldNotBeNull();
obj.GetType().ShouldEqual(typeof(Commit));
@@ -350,7 +350,7 @@ public void CanCommitALittleBit()
{
using (var scd = new SelfCleaningDirectory())
{
- var dir = Repository.Init(scd.DirectoryPath);
+ string dir = Repository.Init(scd.DirectoryPath);
Path.IsPathRooted(dir).ShouldBeTrue();
Directory.Exists(dir).ShouldBeTrue();
@@ -364,7 +364,7 @@ public void CanCommitALittleBit()
repo.Index.Stage("new.txt");
var author = new Signature("Author N. Ame", "him@there.com", DateTimeOffset.Now.AddSeconds(-10));
- var commit = repo.Commit(author, author, "Initial egotistic commit");
+ Commit commit = repo.Commit(author, author, "Initial egotistic commit");
commit.Parents.Count().ShouldEqual(0);
repo.Info.IsEmpty.ShouldBeFalse();
@@ -373,7 +373,7 @@ public void CanCommitALittleBit()
repo.Index.Stage("new.txt");
var author2 = new Signature(author.Name, author.Email, author.When.AddSeconds(5));
- var commit2 = repo.Commit(author2, author2, "Are you trying to fork me?");
+ Commit commit2 = repo.Commit(author2, author2, "Are you trying to fork me?");
commit2.Parents.Count().ShouldEqual(1);
commit2.Parents.First().Id.ShouldEqual(commit.Id);
@@ -386,12 +386,12 @@ public void CanCommitALittleBit()
var author3 = new Signature("David Fowler", "david.fowler@microsoft.com", author.When.AddSeconds(2));
repo.Index.Stage("new.txt");
- var commit3 = repo.Commit(author3, author3, "I'm going to branch you backwards in time!");
+ Commit commit3 = repo.Commit(author3, author3, "I'm going to branch you backwards in time!");
commit3.Parents.Count().ShouldEqual(1);
commit3.Parents.First().Id.ShouldEqual(commit.Id);
}
}
}
}
-}
+}
Oops, something went wrong.

0 comments on commit df04d9d

Please sign in to comment.