From 8e5504679775327fcdaa88328334a981c53332d1 Mon Sep 17 00:00:00 2001 From: RobE Date: Fri, 18 Jul 2025 21:07:04 +1000 Subject: [PATCH 1/4] Update build process for Octopus fork package push --- .github/workflows/ci.yml | 22 ++++++++++++++++++++-- LibGit2Sharp/LibGit2Sharp.csproj | 3 ++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54837ac35..038eab0ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,13 +32,14 @@ jobs: retention-days: 7 - name: Verify trimming compatibility run: dotnet publish TrimmingTestApp + test: name: Test / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.tfm }} runs-on: ${{ matrix.os }} strategy: matrix: arch: [ x64 ] - os: [ windows-2019, windows-2022, macos-13 ] + os: [ windows-2022, macos-13 ] tfm: [ net472, net8.0, net9.0 ] exclude: - os: macos-13 @@ -99,4 +100,21 @@ jobs: git_command="git config --global --add safe.directory /app" test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING" docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" -e OPENSSL_ENABLE_SHA1_SIGNATURES=1 gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$git_command && $test_command" - + + nuget-push: + name: Octopus NuGet Push + needs: [build, test, test-linux] + # && github.ref == 'refs/heads/octopus/master' + if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.event_name != 'schedule' + runs-on: ubuntu-22.04 + steps: + - uses: actions/download-artifact@v4 + with: + path: staging + - name: Push package to feed 🐙 + id: push-feed + shell: bash + env: + FEED_API_KEY: ${{ secrets.FEED_API_KEY }} + FEED_SOURCE: ${{ secrets.FEED_SOURCE }} + run: dotnet nuget push staging/**/*.nupkg --api-key "$FEED_API_KEY" --source "$FEED_SOURCE" \ No newline at end of file diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 1c4abef7b..f3ae850d4 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -19,8 +19,9 @@ App_Readme/README.md App_Readme/LICENSE.md true + Octopus.LibGit2Sharp $(ArtifactsPath)\package - preview.0 + octopus.0 libgit2-$(libgit2_hash.Substring(0,7)) From bdc9c40688a510f6d740152bca193e7a1be5269c Mon Sep 17 00:00:00 2001 From: Dylan Lerch Date: Wed, 2 Nov 2022 09:23:40 +1000 Subject: [PATCH 2/4] Do not use string formatting LibGit2SharpException constructor when building unknown exception types The exception constructors in GitErrorsToLibGit2SharpExceptions make use of the error category by passing it through to the NativeException(string message, GitErrorCategory category) constructor which adds ("libgit2.category", category) to Data on System.Exception. We were calling new LibGit2SharpException(m, c), but this was resolving to the string formatting constructor on LibGit2SharpException, because it does not have a constructor that takes a category. This runs a string format, so if the errorMessage contained any curly braces, that constructor would throw an System.FormatException. This has been changed to just use the message constructor (with no format arguments), and will drop the error code (which is always Unknown anyway). --- LibGit2Sharp/Core/Ensure.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibGit2Sharp/Core/Ensure.cs b/LibGit2Sharp/Core/Ensure.cs index cd681e4ba..87129e0bd 100644 --- a/LibGit2Sharp/Core/Ensure.cs +++ b/LibGit2Sharp/Core/Ensure.cs @@ -148,7 +148,7 @@ private static unsafe void HandleError(int result) Func exceptionBuilder; if (!GitErrorsToLibGit2SharpExceptions.TryGetValue((GitErrorCode)result, out exceptionBuilder)) { - exceptionBuilder = (m, c) => new LibGit2SharpException(m, c); + exceptionBuilder = (m, c) => new LibGit2SharpException(m); } throw exceptionBuilder(errorMessage, errorCategory); From 1367830158e13d0c748ef5ab4c2850b6b401a1fa Mon Sep 17 00:00:00 2001 From: Dylan Lerch Date: Wed, 22 Sep 2021 15:17:49 +1000 Subject: [PATCH 3/4] Set the native libgit2 error message when an exception is thrown in the subtransport --- LibGit2Sharp/SmartSubtransportStream.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/LibGit2Sharp/SmartSubtransportStream.cs b/LibGit2Sharp/SmartSubtransportStream.cs index 008d1fcd0..247e90f34 100644 --- a/LibGit2Sharp/SmartSubtransportStream.cs +++ b/LibGit2Sharp/SmartSubtransportStream.cs @@ -119,6 +119,10 @@ private static int SetError(SmartSubtransportStream stream, Exception caught) { errorCode = ((NativeException)ret).ErrorCode; } + else + { + Proxy.git_error_set_str(GitErrorCategory.Unknown, caught); + } return (int)errorCode; } From 65ca2c09f205b736e266598b31b8be08405910e8 Mon Sep 17 00:00:00 2001 From: RobE Date: Fri, 31 Oct 2025 16:38:15 +1000 Subject: [PATCH 4/4] Re-introduce .net6 while we still have Calamari running in .net6 --- .github/workflows/ci.yml | 5 ++++- .idea/.idea.LibGit2Sharp/.idea/.gitignore | 13 +++++++++++++ .idea/.idea.LibGit2Sharp/.idea/.name | 1 + .idea/.idea.LibGit2Sharp/.idea/encodings.xml | 4 ++++ .idea/.idea.LibGit2Sharp/.idea/indexLayout.xml | 8 ++++++++ .idea/.idea.LibGit2Sharp/.idea/vcs.xml | 6 ++++++ LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj | 2 +- LibGit2Sharp/LibGit2Sharp.csproj | 5 ++++- 8 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 .idea/.idea.LibGit2Sharp/.idea/.gitignore create mode 100644 .idea/.idea.LibGit2Sharp/.idea/.name create mode 100644 .idea/.idea.LibGit2Sharp/.idea/encodings.xml create mode 100644 .idea/.idea.LibGit2Sharp/.idea/indexLayout.xml create mode 100644 .idea/.idea.LibGit2Sharp/.idea/vcs.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 038eab0ec..5a83f6b58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: matrix: arch: [ x64 ] os: [ windows-2022, macos-13 ] - tfm: [ net472, net8.0, net9.0 ] + tfm: [ net472, net6.0, net8.0, net9.0 ] exclude: - os: macos-13 tfm: net472 @@ -63,6 +63,7 @@ jobs: dotnet-version: | 9.0.x 8.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: @@ -81,6 +82,8 @@ jobs: - distro: alpine.3.19 sdk: '9.0' include: + - sdk: '6.0' + tfm: net6.0 - sdk: '8.0' tfm: net8.0 - sdk: '9.0' diff --git a/.idea/.idea.LibGit2Sharp/.idea/.gitignore b/.idea/.idea.LibGit2Sharp/.idea/.gitignore new file mode 100644 index 000000000..b3c268b2e --- /dev/null +++ b/.idea/.idea.LibGit2Sharp/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/contentModel.xml +/projectSettingsUpdater.xml +/modules.xml +/.idea.LibGit2Sharp.iml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.LibGit2Sharp/.idea/.name b/.idea/.idea.LibGit2Sharp/.idea/.name new file mode 100644 index 000000000..1bd867fe1 --- /dev/null +++ b/.idea/.idea.LibGit2Sharp/.idea/.name @@ -0,0 +1 @@ +LibGit2Sharp \ No newline at end of file diff --git a/.idea/.idea.LibGit2Sharp/.idea/encodings.xml b/.idea/.idea.LibGit2Sharp/.idea/encodings.xml new file mode 100644 index 000000000..df87cf951 --- /dev/null +++ b/.idea/.idea.LibGit2Sharp/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.LibGit2Sharp/.idea/indexLayout.xml b/.idea/.idea.LibGit2Sharp/.idea/indexLayout.xml new file mode 100644 index 000000000..7b08163ce --- /dev/null +++ b/.idea/.idea.LibGit2Sharp/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.LibGit2Sharp/.idea/vcs.xml b/.idea/.idea.LibGit2Sharp/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/.idea.LibGit2Sharp/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index fb81a76a3..e769ab3df 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -1,7 +1,7 @@  - net472;net8.0;net9.0 + net472;net6.0;net8.0;net9.0 diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index f3ae850d4..611798631 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -1,7 +1,7 @@  - net472;net8.0 + net472;net8.0;net6.0 12.0 true LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .NET @@ -28,6 +28,9 @@ true + + true +