Skip to content

Commit 53900ea

Browse files
authored
Merge pull request #1511 from libgit2/cleanup
Remove the net40 target and other misc cleanup
2 parents 4627095 + d9dd593 commit 53900ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+325
-436
lines changed

Directory.Build.props

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<Project>
22

33
<PropertyGroup>
4+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
45
<OutputPath>$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
56
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
67
<DefineConstants Condition=" '$(ExtraDefine)' != '' ">$(DefineConstants);$(ExtraDefine)</DefineConstants>
78
</PropertyGroup>
89

9-
<ItemGroup>
10-
<PackageReference Include="Nerdbank.GitVersioning" Version="2.0.37-beta" PrivateAssets="all" />
11-
</ItemGroup>
12-
1310
</Project>

Directory.Build.targets

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
<PropertyGroup>
44
<PublicSign Condition=" '$(AssemblyOriginatorKeyFile)' != '' and '$(OS)' != 'Windows_NT' ">true</PublicSign>
5-
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);IncludePDBsInPackage</TargetsForTfmSpecificContentInPackage>
65
</PropertyGroup>
76

8-
<Target Name="IncludePDBsInPackage">
9-
<ItemGroup>
10-
<TfmSpecificPackageFile Include="$(OutputPath)\$(AssemblyName).pdb" PackagePath="lib/$(TargetFramework)" />
11-
</ItemGroup>
12-
</Target>
13-
147
</Project>

LibGit2Sharp.Tests/BlameFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class BlameFixture : BaseFixture
99
{
1010
private static void AssertCorrectHeadBlame(BlameHunkCollection blame)
1111
{
12-
Assert.Equal(1, blame.Count());
12+
Assert.Single(blame);
1313
Assert.Equal(0, blame[0].FinalStartLineNumber);
1414
Assert.Equal("schacon@gmail.com", blame[0].FinalSignature.Email);
1515
Assert.Equal("4a202b3", blame[0].FinalCommit.Id.ToString(7));
@@ -39,7 +39,7 @@ public void CanBlameFromADifferentCommit()
3939
Assert.Throws<NotFoundException>(() => repo.Blame("ancestor-only.txt"));
4040

4141
var blame = repo.Blame("ancestor-only.txt", new BlameOptions { StartingAt = "9107b30" });
42-
Assert.Equal(1, blame.Count());
42+
Assert.Single(blame);
4343
}
4444
}
4545

@@ -79,7 +79,7 @@ public void CanStopBlame()
7979
// 9fd738e8 (Scott Chacon 2010-05-24 10:19:19 -0700 1) my new file
8080
// (be3563a comes after 9fd738e8)
8181
var blame = repo.Blame("new.txt", new BlameOptions {StoppingAt = "be3563a"});
82-
Assert.True(blame[0].FinalCommit.Sha.StartsWith("be3563a"));
82+
Assert.StartsWith("be3563a", blame[0].FinalCommit.Sha);
8383
}
8484
}
8585
}

LibGit2Sharp.Tests/BlobFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public void CanTellIfTheBlobContentLooksLikeBinary()
216216
using (var repo = new Repository(path))
217217
{
218218
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
219-
Assert.Equal(false, blob.IsBinary);
219+
Assert.False(blob.IsBinary);
220220
}
221221
}
222222

LibGit2Sharp.Tests/BranchFixture.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void CanCreateAnUnbornBranch()
7474
Commit c = repo.Commit("New initial root commit", Constants.Signature, Constants.Signature);
7575

7676
// Ensure this commit has no parent
77-
Assert.Equal(0, c.Parents.Count());
77+
Assert.Empty(c.Parents);
7878

7979
// The branch now exists...
8080
Branch orphan = repo.Branches["orphan"];
@@ -262,7 +262,7 @@ public void CreatingABranchTriggersTheCreationOfADirectReference()
262262

263263
Reference reference = repo.Refs[newBranch.CanonicalName];
264264
Assert.NotNull(reference);
265-
Assert.IsType(typeof(DirectReference), reference);
265+
Assert.IsType<DirectReference>(reference);
266266
}
267267
}
268268

@@ -563,7 +563,7 @@ public void CanGetInformationFromUnbornBranch()
563563
var head = repo.Head;
564564

565565
Assert.Equal("refs/heads/master", head.CanonicalName);
566-
Assert.Equal(0, head.Commits.Count());
566+
Assert.Empty(head.Commits);
567567
Assert.True(head.IsCurrentRepositoryHead);
568568
Assert.False(head.IsRemote);
569569
Assert.Equal("master", head.FriendlyName);
@@ -1123,7 +1123,7 @@ public void TrackedBranchExistsFromDefaultConfigInEmptyClone()
11231123
using (var repo = new Repository(clonedRepoPath))
11241124
{
11251125
Assert.Empty(Directory.GetFiles(scd2.RootedDirectoryPath));
1126-
Assert.Equal(repo.Head.FriendlyName, "master");
1126+
Assert.Equal("master", repo.Head.FriendlyName);
11271127

11281128
Assert.Null(repo.Head.Tip);
11291129
Assert.NotNull(repo.Head.TrackedBranch);

LibGit2Sharp.Tests/CheckoutFixture.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,13 @@ public void CheckoutRetainsUntrackedChanges()
526526
string fullPathFileB = Touch(repo.Info.WorkingDirectory, "b.txt", alternateFileContent);
527527

528528
// Verify that there is an untracked entry.
529-
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
529+
Assert.Single(repo.RetrieveStatus().Untracked);
530530
Assert.Equal(FileStatus.NewInWorkdir, repo.RetrieveStatus(fullPathFileB));
531531

532532
Commands.Checkout(repo, otherBranchName);
533533

534534
// Verify untracked entry still exists.
535-
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
535+
Assert.Single(repo.RetrieveStatus().Untracked);
536536
Assert.Equal(FileStatus.NewInWorkdir, repo.RetrieveStatus(fullPathFileB));
537537
}
538538
}
@@ -550,13 +550,13 @@ public void ForceCheckoutRetainsUntrackedChanges()
550550
string fullPathFileB = Touch(repo.Info.WorkingDirectory, "b.txt", alternateFileContent);
551551

552552
// Verify that there is an untracked entry.
553-
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
553+
Assert.Single(repo.RetrieveStatus().Untracked);
554554
Assert.Equal(FileStatus.NewInWorkdir, repo.RetrieveStatus(fullPathFileB));
555555

556556
Commands.Checkout(repo, otherBranchName, new CheckoutOptions() { CheckoutModifiers = CheckoutModifiers.Force });
557557

558558
// Verify untracked entry still exists.
559-
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
559+
Assert.Single(repo.RetrieveStatus().Untracked);
560560
Assert.Equal(FileStatus.NewInWorkdir, repo.RetrieveStatus(fullPathFileB));
561561
}
562562
}
@@ -574,13 +574,13 @@ public void CheckoutRetainsUnstagedChanges()
574574
string fullPathFileA = Touch(repo.Info.WorkingDirectory, originalFilePath, alternateFileContent);
575575

576576
// Verify that there is a modified entry.
577-
Assert.Equal(1, repo.RetrieveStatus().Modified.Count());
577+
Assert.Single(repo.RetrieveStatus().Modified);
578578
Assert.Equal(FileStatus.ModifiedInWorkdir, repo.RetrieveStatus(fullPathFileA));
579579

580580
Commands.Checkout(repo, otherBranchName);
581581

582582
// Verify modified entry still exists.
583-
Assert.Equal(1, repo.RetrieveStatus().Modified.Count());
583+
Assert.Single(repo.RetrieveStatus().Modified);
584584
Assert.Equal(FileStatus.ModifiedInWorkdir, repo.RetrieveStatus(fullPathFileA));
585585
}
586586
}
@@ -599,13 +599,13 @@ public void CheckoutRetainsStagedChanges()
599599
Commands.Stage(repo, fullPathFileA);
600600

601601
// Verify that there is a staged entry.
602-
Assert.Equal(1, repo.RetrieveStatus().Staged.Count());
602+
Assert.Single(repo.RetrieveStatus().Staged);
603603
Assert.Equal(FileStatus.ModifiedInIndex, repo.RetrieveStatus(fullPathFileA));
604604

605605
Commands.Checkout(repo, otherBranchName);
606606

607607
// Verify staged entry still exists.
608-
Assert.Equal(1, repo.RetrieveStatus().Staged.Count());
608+
Assert.Single(repo.RetrieveStatus().Staged);
609609
Assert.Equal(FileStatus.ModifiedInIndex, repo.RetrieveStatus(fullPathFileA));
610610
}
611611
}
@@ -625,7 +625,7 @@ public void CheckoutRetainsIgnoredChanges()
625625
"bin/some_ignored_file.txt",
626626
"hello from this ignored file.");
627627

628-
Assert.Equal(1, repo.RetrieveStatus(new StatusOptions { IncludeIgnored = true }).Ignored.Count());
628+
Assert.Single(repo.RetrieveStatus(new StatusOptions { IncludeIgnored = true }).Ignored);
629629

630630
Assert.Equal(FileStatus.Ignored, repo.RetrieveStatus(ignoredFilePath));
631631

@@ -652,7 +652,7 @@ public void ForceCheckoutRetainsIgnoredChanges()
652652
"bin/some_ignored_file.txt",
653653
"hello from this ignored file.");
654654

655-
Assert.Equal(1, repo.RetrieveStatus(new StatusOptions { IncludeIgnored = true }).Ignored.Count());
655+
Assert.Single(repo.RetrieveStatus(new StatusOptions { IncludeIgnored = true }).Ignored);
656656

657657
Assert.Equal(FileStatus.Ignored, repo.RetrieveStatus(ignoredFilePath));
658658

@@ -958,7 +958,7 @@ public void CanCheckoutPath(string originalBranch, string checkoutFrom, string p
958958
repo.CheckoutPaths(checkoutFrom, new[] { path });
959959

960960
Assert.Equal(expectedStatus, repo.RetrieveStatus(path));
961-
Assert.Equal(1, repo.RetrieveStatus().Count());
961+
Assert.Single(repo.RetrieveStatus());
962962
}
963963
}
964964

@@ -995,8 +995,7 @@ public void CannotCheckoutPathsWithEmptyOrNullPathArgument()
995995
Assert.False(repo.RetrieveStatus().IsDirty);
996996

997997
// Passing null 'paths' parameter should throw
998-
Assert.Throws(typeof(ArgumentNullException),
999-
() => repo.CheckoutPaths("i-do-numbers", null));
998+
Assert.Throws<ArgumentNullException>(() => repo.CheckoutPaths("i-do-numbers", null));
1000999

10011000
// Passing empty list should do nothing
10021001
repo.CheckoutPaths("i-do-numbers", Enumerable.Empty<string>());

LibGit2Sharp.Tests/CherryPickFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void CherryPickWithConflictDoesNotCommit()
6666
Assert.Equal(CherryPickStatus.Conflicts, cherryPickResult.Status);
6767

6868
Assert.Null(cherryPickResult.Commit);
69-
Assert.Equal(1, repo.Index.Conflicts.Count());
69+
Assert.Single(repo.Index.Conflicts);
7070

7171
var conflict = repo.Index.Conflicts.First();
7272
var changes = repo.Diff.Compare(repo.Lookup<Blob>(conflict.Theirs.Id), repo.Lookup<Blob>(conflict.Ours.Id));
@@ -139,7 +139,7 @@ public void CanCherryPickCommit()
139139
var result = repo.ObjectDatabase.CherryPickCommit(commitToMerge, ours, 0, null);
140140

141141
Assert.Equal(MergeTreeStatus.Succeeded, result.Status);
142-
Assert.Equal(0, result.Conflicts.Count());
142+
Assert.Empty(result.Conflicts);
143143
}
144144
}
145145

LibGit2Sharp.Tests/CleanFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public void CanCleanWorkingDirectory()
1414
{
1515
// Verify that there are the expected number of entries and untracked files
1616
Assert.Equal(6, repo.RetrieveStatus().Count());
17-
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
17+
Assert.Single(repo.RetrieveStatus().Untracked);
1818

1919
repo.RemoveUntrackedFiles();
2020

2121
// Verify that there are the expected number of entries and 0 untracked files
2222
Assert.Equal(5, repo.RetrieveStatus().Count());
23-
Assert.Equal(0, repo.RetrieveStatus().Untracked.Count());
23+
Assert.Empty(repo.RetrieveStatus().Untracked);
2424
}
2525
}
2626

LibGit2Sharp.Tests/CloneFixture.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public void CanClone(string url)
3333
Assert.False(repo.Info.IsBare);
3434

3535
Assert.True(File.Exists(Path.Combine(scd.RootedDirectoryPath, "master.txt")));
36-
Assert.Equal(repo.Head.FriendlyName, "master");
37-
Assert.Equal(repo.Head.Tip.Id.ToString(), "49322bb17d3acc9146f98c97d078513228bbf3c0");
36+
Assert.Equal("master", repo.Head.FriendlyName);
37+
Assert.Equal("49322bb17d3acc9146f98c97d078513228bbf3c0", repo.Head.Tip.Id.ToString());
3838
}
3939
}
4040

@@ -74,7 +74,7 @@ private void AssertLocalClone(string url, string path = null, bool isCloningAnEm
7474
Assert.Equal(isCloningAnEmptyRepository ? 0 : 1, clonedRepo.Branches.Count(b => !b.IsRemote));
7575

7676
Assert.Equal(originalRepo.Tags.Count(), clonedRepo.Tags.Count());
77-
Assert.Equal(1, clonedRepo.Network.Remotes.Count());
77+
Assert.Single(clonedRepo.Network.Remotes);
7878
}
7979
}
8080

@@ -263,7 +263,7 @@ public void CanInspectCertificateOnClone(string url, string hostname, Type certT
263263
Assert.True(valid);
264264
var x509 = ((CertificateX509)cert).Certificate;
265265
// we get a string with the different fields instead of a structure, so...
266-
Assert.True(x509.Subject.Contains("CN=github.com,"));
266+
Assert.Contains("CN=github.com,", x509.Subject);
267267
checksHappy = true;
268268
return false;
269269
}

0 commit comments

Comments
 (0)