From 1be14ba9a39bffca8b6a272ba780a7b1bdf1119d Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Fri, 7 Apr 2023 17:33:44 -0400 Subject: [PATCH 1/8] Update action versions --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 118649aa2..ac62110ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,17 +15,17 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3.5.0 with: fetch-depth: 0 - name: Install .NET SDK - uses: actions/setup-dotnet@v1.8.1 + uses: actions/setup-dotnet@v3.0.3 with: dotnet-version: 6.0.x - name: Build run: dotnet build LibGit2Sharp.sln --configuration Release - name: Upload packages - uses: actions/upload-artifact@v2.2.4 + uses: actions/upload-artifact@v3.1.2 with: name: NuGet packages path: bin/Packages/ @@ -44,16 +44,16 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3.5.0 with: fetch-depth: 0 - name: Install .NET SDK - uses: actions/setup-dotnet@v1.8.1 + uses: actions/setup-dotnet@v3.0.3 with: dotnet-version: 6.0.x - name: Install .NET Core 3.1 runtime if: matrix.tfm == 'netcoreapp3.1' - uses: actions/setup-dotnet@v1.8.1 + uses: actions/setup-dotnet@v3.0.3 with: dotnet-version: 3.1.x - name: Run ${{ matrix.tfm }} tests @@ -86,7 +86,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3.5.0 with: fetch-depth: 0 - name: Setup QEMU From b5bb4d5b168e325cd99539acc5143098a2dbf0e7 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Fri, 7 Apr 2023 17:45:09 -0400 Subject: [PATCH 2/8] Add .NET 7 and remove .NET Core 3.1 --- .github/workflows/ci.yml | 21 +++++++++----------- LibGit2Sharp.Tests/BlobFixture.cs | 6 +++--- LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj | 2 +- LibGit2Sharp/LibGit2Sharp.csproj | 2 +- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac62110ec..878d9ecd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - name: Install .NET SDK uses: actions/setup-dotnet@v3.0.3 with: - dotnet-version: 6.0.x + dotnet-version: 7.0.x - name: Build run: dotnet build LibGit2Sharp.sln --configuration Release - name: Upload packages @@ -36,8 +36,8 @@ jobs: strategy: matrix: arch: [ amd64 ] - os: [windows-2019, macos-10.15] - tfm: [ net472, netcoreapp3.1, net6.0 ] + os: [ windows-2019, macos-10.15 ] + tfm: [ net472, net6.0, net7.0 ] exclude: - os: macos-10.15 tfm: net472 @@ -50,12 +50,9 @@ jobs: - name: Install .NET SDK uses: actions/setup-dotnet@v3.0.3 with: - dotnet-version: 6.0.x - - name: Install .NET Core 3.1 runtime - if: matrix.tfm == 'netcoreapp3.1' - uses: actions/setup-dotnet@v3.0.3 - with: - dotnet-version: 3.1.x + dotnet-version: | + 7.0.x + 6.0.x - name: Run ${{ matrix.tfm }} tests run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING test-linux: @@ -66,7 +63,7 @@ jobs: arch: [ amd64 ] # arch: [ amd64, arm64 ] distro: [ alpine.3.12, alpine.3.13, alpine.3.14, centos.7, centos.8, debian.9, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04 ] - sdk: [ '6.0', '3.1' ] + sdk: [ '6.0', '7.0' ] exclude: - arch: arm64 distro: alpine.3.12 @@ -81,8 +78,8 @@ jobs: include: - sdk: '6.0' tfm: net6.0 - - sdk: '3.1' - tfm: netcoreapp3.1 + - sdk: '7.0' + tfm: net7.0 fail-fast: false steps: - name: Checkout diff --git a/LibGit2Sharp.Tests/BlobFixture.cs b/LibGit2Sharp.Tests/BlobFixture.cs index ea35e59ef..314dea379 100644 --- a/LibGit2Sharp.Tests/BlobFixture.cs +++ b/LibGit2Sharp.Tests/BlobFixture.cs @@ -45,7 +45,7 @@ public void CanGetBlobAsFilteredText(string autocrlf, string expectedText) } } -#if NETFRAMEWORK || NETCOREAPP3_1 //UTF-7 is disabled in .NET 5+ +#if NETFRAMEWORK //UTF-7 is disabled in .NET 5+ [Theory] [InlineData("ascii", 4, "31 32 33 34")] [InlineData("utf-7", 4, "31 32 33 34")] @@ -239,11 +239,11 @@ public void CanTellIfABlobIsMissing() // Manually delete the objects directory to simulate a partial clone Directory.Delete(Path.Combine(repoPath, "objects", "a8"), true); - using (var repo = new Repository(repoPath)) + using (var repo = new Repository(repoPath)) { // Look up for the tree that reference the blob which is now missing var tree = repo.Lookup("fd093bff70906175335656e6ce6ae05783708765"); - var blob = (Blob) tree["README"].Target; + var blob = (Blob)tree["README"].Target; Assert.Equal("a8233120f6ad708f843d861ce2b7228ec4e3dec6", blob.Sha); Assert.NotNull(blob); diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index 25e652522..dc17e6d53 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -1,7 +1,7 @@  - net472;netcoreapp3.1;net6.0 + net472;net6.0;net7.0 diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index c81dd7093..bb6365716 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netcoreapp3.1 + netstandard2.0;net6.0 true LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .NET LibGit2Sharp contributors From fbbfd7121b51a7dd1797cd34f38f9ed736a8b395 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 8 Apr 2023 01:29:05 -0400 Subject: [PATCH 3/8] Fix warning --- LibGit2Sharp/ObjectDatabase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LibGit2Sharp/ObjectDatabase.cs b/LibGit2Sharp/ObjectDatabase.cs index 52aceb321..b48c72a99 100644 --- a/LibGit2Sharp/ObjectDatabase.cs +++ b/LibGit2Sharp/ObjectDatabase.cs @@ -315,10 +315,10 @@ private unsafe Blob CreateBlob(Stream stream, string hintpath, long? numberOfByt throw new EndOfStreamException("The stream ended unexpectedly"); } } - catch(Exception e) + catch (Exception) { writestream.free(writestream_ptr); - throw e; + throw; } ObjectId id = Proxy.git_blob_create_fromstream_commit(writestream_ptr); From 03cb81103f937385d004cadfeddf77a2470d74e1 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 8 Apr 2023 01:34:36 -0400 Subject: [PATCH 4/8] Update testing packages --- LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index dc17e6d53..c5cbb5f24 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -11,12 +11,12 @@ - - - - - - + + + + + + From 81d501c16741a3d7b258750b1b45d56ed2ea9025 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 8 Apr 2023 01:36:17 -0400 Subject: [PATCH 5/8] Update Microsoft.SourceLink.GitHub --- LibGit2Sharp/LibGit2Sharp.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index bb6365716..597f37e31 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -31,7 +31,7 @@ - + From 079daef3aa558a1eb3a12f5b599c222f41077c93 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 8 Apr 2023 01:52:39 -0400 Subject: [PATCH 6/8] Update workflow OSes --- .github/workflows/ci.yml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 878d9ecd1..cf961279d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ env: jobs: build: name: Build - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v3.5.0 @@ -36,10 +36,10 @@ jobs: strategy: matrix: arch: [ amd64 ] - os: [ windows-2019, macos-10.15 ] + os: [ windows-2019, macos-11 ] tfm: [ net472, net6.0, net7.0 ] exclude: - - os: macos-10.15 + - os: macos-11 tfm: net472 fail-fast: false steps: @@ -57,24 +57,18 @@ jobs: run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING test-linux: name: Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: arch: [ amd64 ] # arch: [ amd64, arm64 ] - distro: [ alpine.3.12, alpine.3.13, alpine.3.14, centos.7, centos.8, debian.9, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04 ] + distro: [ alpine.3.13, alpine.3.14, alpine.3.15, alpine.3.16, alpine.3.17, centos.7, centos.stream.8, debian.10, debian.11, fedora.36, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ] sdk: [ '6.0', '7.0' ] exclude: - - arch: arm64 - distro: alpine.3.12 - - arch: arm64 - distro: alpine.3.13 - sdk: '3.1' - - arch: arm64 - distro: alpine.3.14 - sdk: '3.1' - - arch: arm64 - distro: centos.7 + - distro: alpine.3.13 + sdk: '7.0' + - distro: alpine.3.14 + sdk: '7.0' include: - sdk: '6.0' tfm: net6.0 From f1789346c9856f4d93718f605d62d85576a7af5e Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 8 Apr 2023 12:42:43 -0400 Subject: [PATCH 7/8] Remove netstandard2.0 and add net472 --- LibGit2Sharp/Core/NativeMethods.cs | 2 +- LibGit2Sharp/LibGit2Sharp.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index f5d45f3cf..e20d755ba 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -66,7 +66,7 @@ private static string GetGlobalSettingsNativeLibraryPath() return Path.Combine(nativeLibraryDir, libgit2 + Platform.GetNativeLibraryExtension()); } -#if NETSTANDARD +#if NETFRAMEWORK private static bool TryUseNativeLibrary() => false; #else private static bool TryUseNativeLibrary() diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 597f37e31..0b88a3af5 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net6.0 + net472;net6.0 true LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .NET LibGit2Sharp contributors From 48460d087d6622159f929f9aa7476d182ca7078b Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 8 Apr 2023 12:46:16 -0400 Subject: [PATCH 8/8] Fix Assembly CodeBase warning --- LibGit2Sharp/GlobalSettings.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/LibGit2Sharp/GlobalSettings.cs b/LibGit2Sharp/GlobalSettings.cs index f8db7401a..31cba0965 100644 --- a/LibGit2Sharp/GlobalSettings.cs +++ b/LibGit2Sharp/GlobalSettings.cs @@ -20,7 +20,7 @@ public static class GlobalSettings private static string nativeLibraryPath; private static bool nativeLibraryPathLocked; - private static string nativeLibraryDefaultPath; + private static readonly string nativeLibraryDefaultPath = null; static GlobalSettings() { @@ -29,19 +29,18 @@ static GlobalSettings() nativeLibraryPathAllowed = netFX || netCore; +#if NETFRAMEWORK if (netFX) { // For .NET Framework apps the dependencies are deployed to lib/win32/{architecture} directory nativeLibraryDefaultPath = Path.Combine(GetExecutingAssemblyDirectory(), "lib", "win32", Platform.ProcessorArchitecture); } - else - { - nativeLibraryDefaultPath = null; - } +#endif registeredFilters = new Dictionary(); } +#if NETFRAMEWORK private static string GetExecutingAssemblyDirectory() { // Assembly.CodeBase is not actually a correctly formatted @@ -66,6 +65,7 @@ private static string GetExecutingAssemblyDirectory() managedPath = Path.GetDirectoryName(managedPath); return managedPath; } +#endif /// /// Returns information related to the current LibGit2Sharp