diff --git a/.github/workflows/Build_and_publish_package.yml b/.github/workflows/Build_and_publish_package.yml index 56665f6c..1f3c080e 100644 --- a/.github/workflows/Build_and_publish_package.yml +++ b/.github/workflows/Build_and_publish_package.yml @@ -7,7 +7,8 @@ on: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release + BUILD_TYPE: 'Release' + NUPKG_VERSION: '1.101.11' jobs: build: @@ -33,7 +34,7 @@ jobs: run: | nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/mendix/index.json" -UserName srv-LibGit2sharp-mendix -Password ${{ secrets.GHPACKAGESTOKEN }} dotnet build -c Release - nuget pack .\mx_nuget.package\Mendix_package.nuspec -Version 1.101.10 -NoPackageAnalysis + nuget pack .\mx_nuget.package\Mendix_package.nuspec -Version ${{ env.NUPKG_VERSION }} -NoPackageAnalysis shell: powershell #Keep as powershell and not pwsh - name: Upload build artifacts diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index 219615f1..7c138ed1 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -219,7 +219,7 @@ private sealed class NativeShutdownObject : CriticalFinalizerObject internal static extern unsafe GitError* git_error_last(); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern void git_error_set_str( + internal static extern int git_error_set_str( GitErrorCategory error_class, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string errorString); @@ -244,25 +244,25 @@ internal static extern unsafe int git_blame_file( internal static extern unsafe void git_blame_free(git_blame* blame); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern unsafe int git_blob_create_fromdisk( + internal static extern unsafe int git_blob_create_from_disk( ref GitOid id, git_repository* repo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern unsafe int git_blob_create_fromworkdir( + internal static extern unsafe int git_blob_create_from_workdir( ref GitOid id, git_repository* repo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath relative_path); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern unsafe int git_blob_create_fromstream( + internal static extern unsafe int git_blob_create_from_stream( out IntPtr stream, git_repository* repositoryPtr, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string hintpath); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern int git_blob_create_fromstream_commit( + internal static extern int git_blob_create_from_stream_commit( ref GitOid oid, IntPtr stream); @@ -1599,7 +1599,7 @@ internal static extern unsafe int git_repository_open_ext( internal static extern unsafe FilePath git_repository_path(git_repository* repository); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern unsafe void git_repository_set_config( + internal static extern unsafe int git_repository_set_config( git_repository* repository, git_config* config); @@ -1611,7 +1611,7 @@ internal static extern unsafe int git_repository_set_ident( [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern unsafe void git_repository_set_index( + internal static extern unsafe int git_repository_set_index( git_repository* repository, git_index* index); @@ -1693,13 +1693,13 @@ internal static extern unsafe int git_revparse_ext( internal static extern unsafe int git_revwalk_push(git_revwalk* walker, ref GitOid id); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern unsafe void git_revwalk_reset(git_revwalk* walker); + internal static extern unsafe int git_revwalk_reset(git_revwalk* walker); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern unsafe void git_revwalk_sorting(git_revwalk* walk, CommitSortStrategies sort); + internal static extern unsafe int git_revwalk_sorting(git_revwalk* walk, CommitSortStrategies sort); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - internal static extern unsafe void git_revwalk_simplify_first_parent(git_revwalk* walk); + internal static extern unsafe int git_revwalk_simplify_first_parent(git_revwalk* walk); [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void git_signature_free(git_signature* signature); diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index c3a53b95..b9771492 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -36,34 +36,34 @@ public static unsafe BlameHandle git_blame_file( #region git_blob_ - public static unsafe IntPtr git_blob_create_fromstream(RepositoryHandle repo, string hintpath) + public static unsafe IntPtr git_blob_create_from_stream(RepositoryHandle repo, string hintpath) { IntPtr writestream_ptr; - Ensure.ZeroResult(NativeMethods.git_blob_create_fromstream(out writestream_ptr, repo, hintpath)); + Ensure.ZeroResult(NativeMethods.git_blob_create_from_stream(out writestream_ptr, repo, hintpath)); return writestream_ptr; } public static unsafe ObjectId git_blob_create_fromstream_commit(IntPtr writestream_ptr) { var oid = new GitOid(); - Ensure.ZeroResult(NativeMethods.git_blob_create_fromstream_commit(ref oid, writestream_ptr)); + Ensure.ZeroResult(NativeMethods.git_blob_create_from_stream_commit(ref oid, writestream_ptr)); return oid; } - public static unsafe ObjectId git_blob_create_fromdisk(RepositoryHandle repo, FilePath path) + public static unsafe ObjectId git_blob_create_from_disk(RepositoryHandle repo, FilePath path) { var oid = new GitOid(); - int res = NativeMethods.git_blob_create_fromdisk(ref oid, repo, path); + int res = NativeMethods.git_blob_create_from_disk(ref oid, repo, path); Ensure.ZeroResult(res); return oid; } - public static unsafe ObjectId git_blob_create_fromfile(RepositoryHandle repo, FilePath path) + public static unsafe ObjectId git_blob_create_from_workdir(RepositoryHandle repo, FilePath path) { var oid = new GitOid(); - int res = NativeMethods.git_blob_create_fromworkdir(ref oid, repo, path); + int res = NativeMethods.git_blob_create_from_workdir(ref oid, repo, path); Ensure.ZeroResult(res); return oid; @@ -855,21 +855,22 @@ public static unsafe int git_diff_num_deltas(DiffHandle diff) #region git_error_ - public static void git_error_set_str(GitErrorCategory error_class, Exception exception) + public static int git_error_set_str(GitErrorCategory error_class, Exception exception) { if (exception is OutOfMemoryException) { NativeMethods.git_error_set_oom(); + return 0; } else { - NativeMethods.git_error_set_str(error_class, ErrorMessageFromException(exception)); + return NativeMethods.git_error_set_str(error_class, ErrorMessageFromException(exception)); } } - public static void git_error_set_str(GitErrorCategory error_class, String errorString) + public static int git_error_set_str(GitErrorCategory error_class, String errorString) { - NativeMethods.git_error_set_str(error_class, errorString); + return NativeMethods.git_error_set_str(error_class, errorString); } /// @@ -2589,9 +2590,9 @@ public static unsafe FilePath git_repository_path(RepositoryHandle repo) return NativeMethods.git_repository_path(repo); } - public static unsafe void git_repository_set_config(RepositoryHandle repo, ConfigurationHandle config) + public static unsafe int git_repository_set_config(RepositoryHandle repo, ConfigurationHandle config) { - NativeMethods.git_repository_set_config(repo, config); + return NativeMethods.git_repository_set_config(repo, config); } public static unsafe void git_repository_set_ident(RepositoryHandle repo, string name, string email) @@ -2600,9 +2601,9 @@ public static unsafe void git_repository_set_ident(RepositoryHandle repo, string Ensure.ZeroResult(res); } - public static unsafe void git_repository_set_index(RepositoryHandle repo, IndexHandle index) + public static unsafe int git_repository_set_index(RepositoryHandle repo, IndexHandle index) { - NativeMethods.git_repository_set_index(repo, index); + return NativeMethods.git_repository_set_index(repo, index); } public static unsafe void git_repository_set_workdir(RepositoryHandle repo, FilePath workdir) @@ -2783,14 +2784,14 @@ public static unsafe void git_revwalk_reset(RevWalkerHandle walker) NativeMethods.git_revwalk_reset(walker); } - public static unsafe void git_revwalk_sorting(RevWalkerHandle walker, CommitSortStrategies options) + public static unsafe int git_revwalk_sorting(RevWalkerHandle walker, CommitSortStrategies options) { - NativeMethods.git_revwalk_sorting(walker, options); + return NativeMethods.git_revwalk_sorting(walker, options); } - public static unsafe void git_revwalk_simplify_first_parent(RevWalkerHandle walker) + public static unsafe int git_revwalk_simplify_first_parent(RevWalkerHandle walker) { - NativeMethods.git_revwalk_simplify_first_parent(walker); + return NativeMethods.git_revwalk_simplify_first_parent(walker); } #endregion diff --git a/LibGit2Sharp/ObjectDatabase.cs b/LibGit2Sharp/ObjectDatabase.cs index 3a4ebcdb..52aceb32 100644 --- a/LibGit2Sharp/ObjectDatabase.cs +++ b/LibGit2Sharp/ObjectDatabase.cs @@ -104,8 +104,8 @@ public virtual Blob CreateBlob(string path) } ObjectId id = Path.IsPathRooted(path) - ? Proxy.git_blob_create_fromdisk(repo.Handle, path) - : Proxy.git_blob_create_fromfile(repo.Handle, path); + ? Proxy.git_blob_create_from_disk(repo.Handle, path) + : Proxy.git_blob_create_from_workdir(repo.Handle, path); return repo.Lookup(id); } @@ -277,7 +277,7 @@ private unsafe Blob CreateBlob(Stream stream, string hintpath, long? numberOfByt throw new ArgumentException("The stream cannot be read from.", "stream"); } - IntPtr writestream_ptr = Proxy.git_blob_create_fromstream(repo.Handle, hintpath); + IntPtr writestream_ptr = Proxy.git_blob_create_from_stream(repo.Handle, hintpath); GitWriteStream writestream = Marshal.PtrToStructure(writestream_ptr); try diff --git a/mx_nuget.package/Mendix_package.nuspec b/mx_nuget.package/Mendix_package.nuspec index 200a9e73..29883f0e 100644 --- a/mx_nuget.package/Mendix_package.nuspec +++ b/mx_nuget.package/Mendix_package.nuspec @@ -12,6 +12,9 @@ false LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono. + + +