From 8e5504679775327fcdaa88328334a981c53332d1 Mon Sep 17 00:00:00 2001 From: RobE Date: Fri, 18 Jul 2025 21:07:04 +1000 Subject: [PATCH 01/10] 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 02/10] 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 03/10] 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 04/10] 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 + From cf91cb21f5d9c8fc90c4bb479a81791ba76d3341 Mon Sep 17 00:00:00 2001 From: Steven Cleve <107827476+stevencl840@users.noreply.github.com> Date: Fri, 12 Dec 2025 13:44:10 +1100 Subject: [PATCH 05/10] Remove .net 6 --- .github/workflows/ci.yml | 5 +---- LibGit2Sharp/LibGit2Sharp.csproj | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a83f6b58..038eab0ec 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, net6.0, net8.0, net9.0 ] + tfm: [ net472, net8.0, net9.0 ] exclude: - os: macos-13 tfm: net472 @@ -63,7 +63,6 @@ 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: @@ -82,8 +81,6 @@ 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/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 611798631..f3ae850d4 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -1,7 +1,7 @@  - net472;net8.0;net6.0 + net472;net8.0 12.0 true LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .NET @@ -28,9 +28,6 @@ true - - true - From 8219c8ddaf5f41eea53295e95114dece75f25956 Mon Sep 17 00:00:00 2001 From: Steven Cleve <107827476+stevencl840@users.noreply.github.com> Date: Fri, 12 Dec 2025 13:57:36 +1100 Subject: [PATCH 06/10] Update to Macos-14 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 038eab0ec..321c21385 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,10 +39,10 @@ jobs: strategy: matrix: arch: [ x64 ] - os: [ windows-2022, macos-13 ] + os: [ windows-2022, macos-14 ] tfm: [ net472, net8.0, net9.0 ] exclude: - - os: macos-13 + - os: macos-14 tfm: net472 include: - arch: arm64 From 48c47e8384b8edf9a6b37abf735b8045c1f6d783 Mon Sep 17 00:00:00 2001 From: Steven Cleve <107827476+stevencl840@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:18:36 +1100 Subject: [PATCH 07/10] Add nightly build --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++-- LibGit2Sharp/LibGit2Sharp.csproj | 4 ++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 321c21385..5bc1d25d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,14 @@ on: - '[0-9]+.[0-9]+.[0-9]+-*' pull_request: workflow_dispatch: + inputs: + nightly: + description: 'Build as nightly version' + required: false + type: boolean + default: false + schedule: + - cron: '0 15 * * *' # Run at 3 PM UTC (1 AM Melbourne AEST / 2 AM AEDT) env: DOTNET_NOLOGO: true jobs: @@ -23,7 +31,22 @@ jobs: with: dotnet-version: 9.0.x - name: Build - run: dotnet build LibGit2Sharp.sln --configuration Release + run: | + # if it is a pull request build set the build identity to branchname.runnumber + if ("${{ github.event_name }}" -eq "pull_request" -and "${{ github.head_ref }}" -ne "") { + $branchName = "${{ github.head_ref }}" -replace '[/\\]', '-' -replace '[^a-zA-Z0-9\-]', '' + $buildIdentity = "$branchName.${{ github.run_number }}" + + $env:BUILD_IDENTITY = $buildIdentity + } + + # if it is a scheduled build set the build identity to nightly + if ("${{ github.event_name }}" -eq "schedule" -or "${{ inputs.nightly }}" -eq "true") { + $env:BUILD_IDENTITY = "nightly.${{ github.run_number }}" + } + + dotnet build LibGit2Sharp.sln --configuration Release + shell: pwsh - name: Upload packages uses: actions/upload-artifact@v4.3.1 with: @@ -105,7 +128,7 @@ jobs: 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' + if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' runs-on: ubuntu-22.04 steps: - uses: actions/download-artifact@v4 diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index f3ae850d4..5305e7e2f 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -29,6 +29,10 @@ true + + octopus-$(BUILD_IDENTITY) + + From 3de21f6c4ffead9dbdd7273a2db580fdfb907fde Mon Sep 17 00:00:00 2001 From: Steven Cleve <107827476+stevencl840@users.noreply.github.com> Date: Fri, 19 Dec 2025 08:26:44 +1100 Subject: [PATCH 08/10] Remove nigtly flag --- .github/workflows/ci.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bc1d25d7..6f744467b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,6 @@ on: - '[0-9]+.[0-9]+.[0-9]+-*' pull_request: workflow_dispatch: - inputs: - nightly: - description: 'Build as nightly version' - required: false - type: boolean - default: false schedule: - cron: '0 15 * * *' # Run at 3 PM UTC (1 AM Melbourne AEST / 2 AM AEDT) env: @@ -35,13 +29,12 @@ jobs: # if it is a pull request build set the build identity to branchname.runnumber if ("${{ github.event_name }}" -eq "pull_request" -and "${{ github.head_ref }}" -ne "") { $branchName = "${{ github.head_ref }}" -replace '[/\\]', '-' -replace '[^a-zA-Z0-9\-]', '' - $buildIdentity = "$branchName.${{ github.run_number }}" - $env:BUILD_IDENTITY = $buildIdentity + $env:BUILD_IDENTITY = "$branchName.${{ github.run_number }}" } # if it is a scheduled build set the build identity to nightly - if ("${{ github.event_name }}" -eq "schedule" -or "${{ inputs.nightly }}" -eq "true") { + if ("${{ github.event_name }}" -eq "schedule") { $env:BUILD_IDENTITY = "nightly.${{ github.run_number }}" } From 4414d724689536329ef298dc826186cd7a980f1d Mon Sep 17 00:00:00 2001 From: Steven Cleve <107827476+stevencl840@users.noreply.github.com> Date: Fri, 19 Dec 2025 08:35:54 +1100 Subject: [PATCH 09/10] One last try --- LibGit2Sharp/LibGit2Sharp.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 5305e7e2f..cbb05e648 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -31,6 +31,7 @@ octopus-$(BUILD_IDENTITY) + true From 4f195c6efde0844dff740c7d63f6e8dd8a8d032b Mon Sep 17 00:00:00 2001 From: Steven Cleve <107827476+stevencl840@users.noreply.github.com> Date: Fri, 19 Dec 2025 08:45:41 +1100 Subject: [PATCH 10/10] Revert --- LibGit2Sharp/LibGit2Sharp.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index cbb05e648..5305e7e2f 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -31,7 +31,6 @@ octopus-$(BUILD_IDENTITY) - true