diff --git a/.github/workflows/Build_and_publish_package.yml b/.github/workflows/Build_and_publish_package.yml index 714fcd8b..d3f063b6 100644 --- a/.github/workflows/Build_and_publish_package.yml +++ b/.github/workflows/Build_and_publish_package.yml @@ -35,7 +35,7 @@ jobs: # After build we copy the binaries to package output folder # Finally we pack and push the package to github packages - name: Deploy Package - if: github.event_name == 'push' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' run: | dotnet nuget add source "https://nuget.pkg.github.com/mendix/index.json" --name "GitHub" --username ${{ secrets.GHPACKAGESUSER }} --password ${{ secrets.GHPACKAGESTOKEN }} dotnet nuget push "**/mx_nuget/Mendix.LibGit2Sharp*.nupkg" --source "GitHub" --skip-duplicate diff --git a/LibGit2Sharp.Tests/BlobFixture.cs b/LibGit2Sharp.Tests/BlobFixture.cs index e6a5f3c5..7afbe255 100644 --- a/LibGit2Sharp.Tests/BlobFixture.cs +++ b/LibGit2Sharp.Tests/BlobFixture.cs @@ -3,7 +3,6 @@ using System.Text; using LibGit2Sharp.Tests.TestHelpers; using Xunit; -using Xunit.Extensions; namespace LibGit2Sharp.Tests { @@ -44,6 +43,7 @@ public void CanGetBlobAsFilteredText(string autocrlf, string expectedText) } } +#if NETFRAMEWORK || NETCOREAPP2_1 [Theory] [InlineData("ascii", 4, "31 32 33 34")] [InlineData("utf-7", 4, "31 32 33 34")] @@ -83,6 +83,7 @@ public void CanGetBlobAsTextWithVariousEncodings(string encodingName, int expect Assert.Equal(expectedUtf7Chars, string.Join(" ", utf7Chars)); } } +#endif [Fact] public void CanGetBlobSize() @@ -185,7 +186,7 @@ public void CanStageAFileGeneratedFromABlobContentStream() var sb = new StringBuilder(); for (int j = 0; j < 2000; j++) { - sb.Append(((i + 1)*(j + 1)).ToString("X8")); + sb.Append(((i + 1) * (j + 1)).ToString("X8")); } File.AppendAllText(Path.Combine(repo.Info.WorkingDirectory, "small.txt"), sb.ToString()); } diff --git a/LibGit2Sharp.Tests/CloneFixture.cs b/LibGit2Sharp.Tests/CloneFixture.cs index be940881..9e41bc45 100644 --- a/LibGit2Sharp.Tests/CloneFixture.cs +++ b/LibGit2Sharp.Tests/CloneFixture.cs @@ -70,7 +70,7 @@ private void AssertLocalClone(string url, string path = null, bool isCloningAnEm Assert.NotEqual(originalRepo.Info.Path, clonedRepo.Info.Path); Assert.Equal(originalRepo.Head, clonedRepo.Head); - Assert.Equal(originalRepo.Branches.Count(), clonedRepo.Branches.Count(b => b.IsRemote)); + Assert.Equal(originalRepo.Branches.Count(), clonedRepo.Branches.Count(b => b.IsRemote && b.FriendlyName != "origin/HEAD")); Assert.Equal(isCloningAnEmptyRepository ? 0 : 1, clonedRepo.Branches.Count(b => !b.IsRemote)); Assert.Equal(originalRepo.Tags.Count(), clonedRepo.Tags.Count()); diff --git a/LibGit2Sharp.Tests/FetchFixture.cs b/LibGit2Sharp.Tests/FetchFixture.cs index 8e50683f..b9a85e08 100644 --- a/LibGit2Sharp.Tests/FetchFixture.cs +++ b/LibGit2Sharp.Tests/FetchFixture.cs @@ -215,7 +215,7 @@ public void FetchHonorsTheFetchPruneConfigurationEntry() using (var clonedRepo = new Repository(clonedRepoPath)) { - Assert.Equal(5, clonedRepo.Branches.Count(b => b.IsRemote)); + Assert.Equal(5, clonedRepo.Branches.Count(b => b.IsRemote && b.FriendlyName != "origin/HEAD")); // Drop one of the branches in the remote repository using (var sourceRepo = new Repository(source)) @@ -226,17 +226,17 @@ public void FetchHonorsTheFetchPruneConfigurationEntry() // No pruning when the configuration entry isn't defined Assert.Null(clonedRepo.Config.Get("fetch.prune")); Commands.Fetch(clonedRepo, "origin", new string[0], null, null, null); - Assert.Equal(5, clonedRepo.Branches.Count(b => b.IsRemote)); + Assert.Equal(5, clonedRepo.Branches.Count(b => b.IsRemote && b.FriendlyName != "origin/HEAD")); // No pruning when the configuration entry is set to false clonedRepo.Config.Set("fetch.prune", false); Commands.Fetch(clonedRepo, "origin", new string[0], null, null, null); - Assert.Equal(5, clonedRepo.Branches.Count(b => b.IsRemote)); + Assert.Equal(5, clonedRepo.Branches.Count(b => b.IsRemote && b.FriendlyName != "origin/HEAD")); // Auto pruning when the configuration entry is set to true clonedRepo.Config.Set("fetch.prune", true); Commands.Fetch(clonedRepo, "origin", new string[0], null, null, null); - Assert.Equal(4, clonedRepo.Branches.Count(b => b.IsRemote)); + Assert.Equal(4, clonedRepo.Branches.Count(b => b.IsRemote && b.FriendlyName != "origin/HEAD")); } } diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index d45756f4..1810df2e 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -1,28 +1,28 @@  - net472;net5.0 + net472;netcoreapp2.1;net5.0 - - + + - - - + + + - - + + - + diff --git a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs index a61d920d..e1cfefd8 100644 --- a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs +++ b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs @@ -7,7 +7,6 @@ using System.Reflection; using System.Text; using System.Text.RegularExpressions; -using LibGit2Sharp.Core; using Xunit; namespace LibGit2Sharp.Tests.TestHelpers @@ -21,7 +20,7 @@ public BaseFixture() BuildFakeConfigs(this); #if LEAKS_IDENTIFYING - LeaksContainer.Clear(); + Core.LeaksContainer.Clear(); #endif } @@ -65,7 +64,11 @@ private static void SetUpTestEnvironment() if (resourcesPath == null) { +#if NETFRAMEWORK resourcesPath = Path.Combine(Directory.GetParent(new Uri(typeof(BaseFixture).GetTypeInfo().Assembly.CodeBase).LocalPath).FullName, "Resources"); +#else + resourcesPath = Path.Combine(Directory.GetParent(typeof(BaseFixture).GetTypeInfo().Assembly.Location).FullName, "Resources"); +#endif } ResourcesDirectory = new DirectoryInfo(resourcesPath); @@ -273,11 +276,11 @@ public virtual void Dispose() GC.Collect(); GC.WaitForPendingFinalizers(); - if (LeaksContainer.TypeNames.Any()) + if (Core.LeaksContainer.TypeNames.Any()) { Assert.False(true, string.Format("Some handles of the following types haven't been properly released: {0}.{1}" + "In order to get some help fixing those leaks, uncomment the define LEAKS_TRACKING in Libgit2Object.cs{1}" - + "and run the tests locally.", string.Join(", ", LeaksContainer.TypeNames), Environment.NewLine)); + + "and run the tests locally.", string.Join(", ", Core.LeaksContainer.TypeNames), Environment.NewLine)); } #endif } diff --git a/LibGit2Sharp/Core/GitOdbBackend.cs b/LibGit2Sharp/Core/GitOdbBackend.cs index 0d68a343..3ff03104 100644 --- a/LibGit2Sharp/Core/GitOdbBackend.cs +++ b/LibGit2Sharp/Core/GitOdbBackend.cs @@ -33,6 +33,9 @@ static GitOdbBackend() public exists_prefix_callback ExistsPrefix; public IntPtr Refresh; public foreach_callback Foreach; + + private IntPtr Padding; // TODO: add writemidx + public IntPtr Writepack; public IntPtr Freshen; public free_callback Free; diff --git a/LibGit2Sharp/Core/GitRebaseOptions.cs b/LibGit2Sharp/Core/GitRebaseOptions.cs index e1416e80..981bfe91 100644 --- a/LibGit2Sharp/Core/GitRebaseOptions.cs +++ b/LibGit2Sharp/Core/GitRebaseOptions.cs @@ -18,6 +18,8 @@ internal class GitRebaseOptions public GitCheckoutOpts checkout_options = new GitCheckoutOpts { version = 1 }; + private IntPtr padding; // TODO: add git_commit_create_cb + public NativeMethods.commit_signing_callback signing_callback; } } diff --git a/LibGit2Sharp/Core/GitRemoteCallbacks.cs b/LibGit2Sharp/Core/GitRemoteCallbacks.cs index 54cdb46e..4900ad56 100644 --- a/LibGit2Sharp/Core/GitRemoteCallbacks.cs +++ b/LibGit2Sharp/Core/GitRemoteCallbacks.cs @@ -33,6 +33,8 @@ internal struct GitRemoteCallbacks internal IntPtr transport; + private IntPtr padding; // TODO: add git_remote_ready_cb + internal IntPtr payload; internal NativeMethods.url_resolve_callback resolve_url; diff --git a/LibGit2Sharp/Core/GitStatusOptions.cs b/LibGit2Sharp/Core/GitStatusOptions.cs index 3e9dbd5d..d577cefe 100644 --- a/LibGit2Sharp/Core/GitStatusOptions.cs +++ b/LibGit2Sharp/Core/GitStatusOptions.cs @@ -13,6 +13,8 @@ internal class GitStatusOptions : IDisposable public GitStrArrayManaged PathSpec; + public IntPtr Baseline = IntPtr.Zero; + public void Dispose() { PathSpec.Dispose(); diff --git a/LibGit2Sharp/Core/GitWorktree.cs b/LibGit2Sharp/Core/GitWorktree.cs index 64f90ebb..c71cb16c 100644 --- a/LibGit2Sharp/Core/GitWorktree.cs +++ b/LibGit2Sharp/Core/GitWorktree.cs @@ -33,8 +33,10 @@ internal enum GitWorktreePruneOptionFlags : uint internal class git_worktree_add_options { public uint version = 1; - + public int locked; + + public IntPtr @ref = IntPtr.Zero; } [StructLayout(LayoutKind.Sequential)] diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 52e0fedd..c0c2538b 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -34,9 +34,9 @@ - + - + diff --git a/version.json b/version.json index 663c06b2..67e932a0 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.111.100", + "version": "1.120.0", "cloudBuild": { "buildNumber": { "enabled": true