Skip to content

Commit

Permalink
Merge pull request libgit2#1511 from libgit2/cleanup
Browse files Browse the repository at this point in the history
Remove the net40 target and other misc cleanup
  • Loading branch information
ethomson committed Nov 24, 2017
2 parents f333bff + 0cf6540 commit 1e57230
Show file tree
Hide file tree
Showing 64 changed files with 325 additions and 436 deletions.
5 changes: 1 addition & 4 deletions Directory.Build.props
@@ -1,13 +1,10 @@
<Project>

<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputPath>$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<DefineConstants Condition=" '$(ExtraDefine)' != '' ">$(DefineConstants);$(ExtraDefine)</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="2.0.37-beta" PrivateAssets="all" />
</ItemGroup>

</Project>
7 changes: 0 additions & 7 deletions Directory.Build.targets
Expand Up @@ -2,13 +2,6 @@

<PropertyGroup>
<PublicSign Condition=" '$(AssemblyOriginatorKeyFile)' != '' and '$(OS)' != 'Windows_NT' ">true</PublicSign>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);IncludePDBsInPackage</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<Target Name="IncludePDBsInPackage">
<ItemGroup>
<TfmSpecificPackageFile Include="$(OutputPath)\$(AssemblyName).pdb" PackagePath="lib/$(TargetFramework)" />
</ItemGroup>
</Target>

</Project>
6 changes: 3 additions & 3 deletions LibGit2Sharp.Tests/BlameFixture.cs
Expand Up @@ -9,7 +9,7 @@ public class BlameFixture : BaseFixture
{
private static void AssertCorrectHeadBlame(BlameHunkCollection blame)
{
Assert.Equal(1, blame.Count());
Assert.Single(blame);
Assert.Equal(0, blame[0].FinalStartLineNumber);
Assert.Equal("schacon@gmail.com", blame[0].FinalSignature.Email);
Assert.Equal("4a202b3", blame[0].FinalCommit.Id.ToString(7));
Expand Down Expand Up @@ -39,7 +39,7 @@ public void CanBlameFromADifferentCommit()
Assert.Throws<NotFoundException>(() => repo.Blame("ancestor-only.txt"));

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

Expand Down Expand Up @@ -79,7 +79,7 @@ public void CanStopBlame()
// 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"});
Assert.True(blame[0].FinalCommit.Sha.StartsWith("be3563a"));
Assert.StartsWith("be3563a", blame[0].FinalCommit.Sha);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp.Tests/BlobFixture.cs
Expand Up @@ -216,7 +216,7 @@ public void CanTellIfTheBlobContentLooksLikeBinary()
using (var repo = new Repository(path))
{
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
Assert.Equal(false, blob.IsBinary);
Assert.False(blob.IsBinary);
}
}

Expand Down
8 changes: 4 additions & 4 deletions LibGit2Sharp.Tests/BranchFixture.cs
Expand Up @@ -74,7 +74,7 @@ public void CanCreateAnUnbornBranch()
Commit c = repo.Commit("New initial root commit", Constants.Signature, Constants.Signature);

// Ensure this commit has no parent
Assert.Equal(0, c.Parents.Count());
Assert.Empty(c.Parents);

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

Reference reference = repo.Refs[newBranch.CanonicalName];
Assert.NotNull(reference);
Assert.IsType(typeof(DirectReference), reference);
Assert.IsType<DirectReference>(reference);
}
}

Expand Down Expand Up @@ -563,7 +563,7 @@ public void CanGetInformationFromUnbornBranch()
var head = repo.Head;

Assert.Equal("refs/heads/master", head.CanonicalName);
Assert.Equal(0, head.Commits.Count());
Assert.Empty(head.Commits);
Assert.True(head.IsCurrentRepositoryHead);
Assert.False(head.IsRemote);
Assert.Equal("master", head.FriendlyName);
Expand Down Expand Up @@ -1123,7 +1123,7 @@ public void TrackedBranchExistsFromDefaultConfigInEmptyClone()
using (var repo = new Repository(clonedRepoPath))
{
Assert.Empty(Directory.GetFiles(scd2.RootedDirectoryPath));
Assert.Equal(repo.Head.FriendlyName, "master");
Assert.Equal("master", repo.Head.FriendlyName);

Assert.Null(repo.Head.Tip);
Assert.NotNull(repo.Head.TrackedBranch);
Expand Down
25 changes: 12 additions & 13 deletions LibGit2Sharp.Tests/CheckoutFixture.cs
Expand Up @@ -526,13 +526,13 @@ public void CheckoutRetainsUntrackedChanges()
string fullPathFileB = Touch(repo.Info.WorkingDirectory, "b.txt", alternateFileContent);

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

Commands.Checkout(repo, otherBranchName);

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

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

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

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

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

Commands.Checkout(repo, otherBranchName);

// Verify modified entry still exists.
Assert.Equal(1, repo.RetrieveStatus().Modified.Count());
Assert.Single(repo.RetrieveStatus().Modified);
Assert.Equal(FileStatus.ModifiedInWorkdir, repo.RetrieveStatus(fullPathFileA));
}
}
Expand All @@ -599,13 +599,13 @@ public void CheckoutRetainsStagedChanges()
Commands.Stage(repo, fullPathFileA);

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

Commands.Checkout(repo, otherBranchName);

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

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

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

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

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

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

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

Assert.Equal(expectedStatus, repo.RetrieveStatus(path));
Assert.Equal(1, repo.RetrieveStatus().Count());
Assert.Single(repo.RetrieveStatus());
}
}

Expand Down Expand Up @@ -995,8 +995,7 @@ public void CannotCheckoutPathsWithEmptyOrNullPathArgument()
Assert.False(repo.RetrieveStatus().IsDirty);

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

// Passing empty list should do nothing
repo.CheckoutPaths("i-do-numbers", Enumerable.Empty<string>());
Expand Down
4 changes: 2 additions & 2 deletions LibGit2Sharp.Tests/CherryPickFixture.cs
Expand Up @@ -66,7 +66,7 @@ public void CherryPickWithConflictDoesNotCommit()
Assert.Equal(CherryPickStatus.Conflicts, cherryPickResult.Status);

Assert.Null(cherryPickResult.Commit);
Assert.Equal(1, repo.Index.Conflicts.Count());
Assert.Single(repo.Index.Conflicts);

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

Assert.Equal(MergeTreeStatus.Succeeded, result.Status);
Assert.Equal(0, result.Conflicts.Count());
Assert.Empty(result.Conflicts);
}
}

Expand Down
4 changes: 2 additions & 2 deletions LibGit2Sharp.Tests/CleanFixture.cs
Expand Up @@ -14,13 +14,13 @@ public void CanCleanWorkingDirectory()
{
// Verify that there are the expected number of entries and untracked files
Assert.Equal(6, repo.RetrieveStatus().Count());
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
Assert.Single(repo.RetrieveStatus().Untracked);

repo.RemoveUntrackedFiles();

// Verify that there are the expected number of entries and 0 untracked files
Assert.Equal(5, repo.RetrieveStatus().Count());
Assert.Equal(0, repo.RetrieveStatus().Untracked.Count());
Assert.Empty(repo.RetrieveStatus().Untracked);
}
}

Expand Down
8 changes: 4 additions & 4 deletions LibGit2Sharp.Tests/CloneFixture.cs
Expand Up @@ -33,8 +33,8 @@ public void CanClone(string url)
Assert.False(repo.Info.IsBare);

Assert.True(File.Exists(Path.Combine(scd.RootedDirectoryPath, "master.txt")));
Assert.Equal(repo.Head.FriendlyName, "master");
Assert.Equal(repo.Head.Tip.Id.ToString(), "49322bb17d3acc9146f98c97d078513228bbf3c0");
Assert.Equal("master", repo.Head.FriendlyName);
Assert.Equal("49322bb17d3acc9146f98c97d078513228bbf3c0", repo.Head.Tip.Id.ToString());
}
}

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

Assert.Equal(originalRepo.Tags.Count(), clonedRepo.Tags.Count());
Assert.Equal(1, clonedRepo.Network.Remotes.Count());
Assert.Single(clonedRepo.Network.Remotes);
}
}

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

0 comments on commit 1e57230

Please sign in to comment.