From 7db8296567a0da9d05e34adb8cb44401bc1d65e1 Mon Sep 17 00:00:00 2001 From: Yariv Kenan Date: Tue, 27 Feb 2024 13:55:05 -0800 Subject: [PATCH 1/5] add cyclic check --- LibGit2Sharp/CyclicReferenceException.cs | 11 +++++++++++ LibGit2Sharp/Reference.cs | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 LibGit2Sharp/CyclicReferenceException.cs diff --git a/LibGit2Sharp/CyclicReferenceException.cs b/LibGit2Sharp/CyclicReferenceException.cs new file mode 100644 index 000000000..006812f3c --- /dev/null +++ b/LibGit2Sharp/CyclicReferenceException.cs @@ -0,0 +1,11 @@ +namespace LibGit2Sharp +{ + public class CyclicReferenceException : LibGit2SharpException + { + public CyclicReferenceException(string reference) : base($"Detected cyclic reference on '{reference}'") + { + } + + protected CyclicReferenceException() {} + } +} diff --git a/LibGit2Sharp/Reference.cs b/LibGit2Sharp/Reference.cs index 40a85f79f..7de3177d1 100644 --- a/LibGit2Sharp/Reference.cs +++ b/LibGit2Sharp/Reference.cs @@ -54,6 +54,11 @@ internal static unsafe T BuildFromPtr(git_reference* handle, Repository repo) case GitReferenceType.Symbolic: string targetIdentifier = Proxy.git_reference_symbolic_target(handle); + if (name == targetIdentifier) + { + throw new CyclicReferenceException(name); + } + var targetRef = repo.Refs[targetIdentifier]; reference = new SymbolicReference(repo, name, targetIdentifier, targetRef); break; From c9590ea0e07051e27060b9200d9bf5650eedc30c Mon Sep 17 00:00:00 2001 From: Yariv Kenan Date: Tue, 27 Feb 2024 13:55:51 -0800 Subject: [PATCH 2/5] gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2f75ccc1d..08c5e1af4 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ _ReSharper*/ _NCrunch_LibGit2Sharp/ packages/ worktree.playlist +.idea/ From 32d6b799e6f3329ccda3e22a275cb8c569785a0c Mon Sep 17 00:00:00 2001 From: Yariv Kenan Date: Tue, 27 Feb 2024 14:00:30 -0800 Subject: [PATCH 3/5] . --- .github/workflows/ci.yml | 16 ++++------------ LibGit2Sharp.sln | 2 +- LibGit2Sharp/LibGit2Sharp.csproj | 7 ++++--- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f44285812..3f419d8c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,8 +36,8 @@ jobs: strategy: matrix: arch: [ amd64 ] - os: [ windows-2019, macos-11 ] - tfm: [ net472, net6.0, net7.0 ] + os: [ macos-11 ] + tfm: [ net6.0, net7.0 ] exclude: - os: macos-11 tfm: net472 @@ -61,19 +61,11 @@ jobs: strategy: matrix: arch: [ amd64 ] - # arch: [ amd64, arm64 ] - 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: - - distro: alpine.3.13 - sdk: '7.0' - - distro: alpine.3.14 - sdk: '7.0' + distro: [ alpine.3.18, debian.11 ] + sdk: [ '6.0' ] include: - sdk: '6.0' tfm: net6.0 - - sdk: '7.0' - tfm: net7.0 fail-fast: false steps: - name: Checkout diff --git a/LibGit2Sharp.sln b/LibGit2Sharp.sln index e99eec26f..d9970f59f 100644 --- a/LibGit2Sharp.sln +++ b/LibGit2Sharp.sln @@ -12,7 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Targets\CodeGenerator.targets = Targets\CodeGenerator.targets Directory.Build.props = Directory.Build.props Targets\GenerateNativeDllName.targets = Targets\GenerateNativeDllName.targets - nuget.config = nuget.config + README.md = README.md EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NativeLibraryLoadTestApp.x86", "NativeLibraryLoadTestApp\x86\NativeLibraryLoadTestApp.x86.csproj", "{86453D2C-4953-4DF4-B12A-ADE579608BAA}" diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index f690c9107..d101732a8 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -1,14 +1,15 @@  + Apiiro.LibGit2Sharp 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 + Apiiro + Apiiro Copyright © LibGit2Sharp contributors libgit2 git - https://github.com/libgit2/libgit2sharp/ - LibGit2Sharp contributors + https://github.com/apiiro/libgit2sharp true true embedded From 293a5f5fad1cb6a22676b71cf3a72f7ec7763ea3 Mon Sep 17 00:00:00 2001 From: Yariv Kenan Date: Tue, 27 Feb 2024 14:01:21 -0800 Subject: [PATCH 4/5] . --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3aafdceb1..4ee730c80 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,19 @@ # LibGit2Sharp -[![CI](https://github.com/libgit2/libgit2sharp/actions/workflows/ci.yml/badge.svg)](https://github.com/libgit2/libgit2sharp/actions/workflows/ci.yml) +[![CI](https://github.com/libgit2/libgit2sharp/actions/workflows/ci.yml/badge.svg)](https://github.com/libgit2/libgit2sharp/actions/workflows/ci.yml) [![NuGet version (LibGit2Sharp)](https://img.shields.io/nuget/v/LibGit2Sharp.svg)](https://www.nuget.org/packages/LibGit2Sharp/) **LibGit2Sharp brings all the might and speed of [libgit2](http://libgit2.github.com/), a native Git implementation, to the managed world of .NET** +To push to apiiro nuget package: + +``` +dotnet build --configuration Release +rm bin/Packages/Apiiro.LibGit2Sharp.*.nupkg +dotnet pack --configuration Release +dotnet nuget push bin/Packages/Apiiro.LibGit2Sharp.*.nupkg --source "github" --skip-duplicate --no-symbols +``` + ## Online resources - [NuGet package](http://nuget.org/List/Packages/LibGit2Sharp) From 4e5eb555680e83b365aed814d8d8c883a7351e4a Mon Sep 17 00:00:00 2001 From: Yariv Kenan Date: Tue, 27 Feb 2024 14:01:46 -0800 Subject: [PATCH 5/5] / --- LibGit2Sharp/LibGit2Sharp.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index d101732a8..464f538ec 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -51,7 +51,7 @@ $(MinVerMajor).$(MinVerMinor).0.0 - $(MinVerMajor).$(MinVerMinor).$(MinVerPatch) + 0.27.2 $(PackageVersion)-$(MinVerPreRelease)