Skip to content

Commit f958478

Browse files
A-Ovchinnikov-mxMarcellvanRooyen
authored and
Alexander Ovchinnikov
committed
Finish update to v1.0.1 (#3)
* Update Native Method names and signatures as per: https://github.com/libgit2/libgit2/blob/master/docs/changelog.md#v099 Co-authored-by: Marcell van Rooyen <marcell.van.rooyen@mendix.com>
1 parent 639292f commit f958478

File tree

4 files changed

+36
-34
lines changed

4 files changed

+36
-34
lines changed

.github/workflows/Build_and_publish_package.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77

88
env:
99
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
10-
BUILD_TYPE: Release
10+
BUILD_TYPE: 'Release'
11+
NUPKG_VERSION: '1.101.11'
1112

1213
jobs:
1314
build:
@@ -33,7 +34,7 @@ jobs:
3334
run: |
3435
nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/mendix/index.json" -UserName srv-LibGit2sharp-mendix -Password ${{ secrets.GHPACKAGESTOKEN }}
3536
dotnet build -c Release
36-
nuget pack .\mx_nuget.package\Mendix_package.nuspec -Version 1.101.10 -NoPackageAnalysis
37+
nuget pack .\mx_nuget.package\Mendix_package.nuspec -Version ${{ env.NUPKG_VERSION }} -NoPackageAnalysis
3738
shell: powershell #Keep as powershell and not pwsh
3839

3940
- name: Upload build artifacts

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private sealed class NativeShutdownObject : CriticalFinalizerObject
9999
internal static extern unsafe GitError* git_error_last();
100100

101101
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
102-
internal static extern void git_error_set_str(
102+
internal static extern int git_error_set_str(
103103
GitErrorCategory error_class,
104104
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string errorString);
105105

@@ -124,25 +124,25 @@ internal static extern unsafe int git_blame_file(
124124
internal static extern unsafe void git_blame_free(git_blame* blame);
125125

126126
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
127-
internal static extern unsafe int git_blob_create_fromdisk(
127+
internal static extern unsafe int git_blob_create_from_disk(
128128
ref GitOid id,
129129
git_repository* repo,
130130
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path);
131131

132132
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
133-
internal static extern unsafe int git_blob_create_fromworkdir(
133+
internal static extern unsafe int git_blob_create_from_workdir(
134134
ref GitOid id,
135135
git_repository* repo,
136136
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath relative_path);
137137

138138
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
139-
internal static extern unsafe int git_blob_create_fromstream(
139+
internal static extern unsafe int git_blob_create_from_stream(
140140
out IntPtr stream,
141141
git_repository* repositoryPtr,
142142
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string hintpath);
143143

144144
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
145-
internal static extern int git_blob_create_fromstream_commit(
145+
internal static extern int git_blob_create_from_stream_commit(
146146
ref GitOid oid,
147147
IntPtr stream);
148148

@@ -1465,7 +1465,7 @@ internal static extern unsafe int git_repository_open_ext(
14651465
internal static extern unsafe FilePath git_repository_path(git_repository* repository);
14661466

14671467
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
1468-
internal static extern unsafe void git_repository_set_config(
1468+
internal static extern unsafe int git_repository_set_config(
14691469
git_repository* repository,
14701470
git_config* config);
14711471

@@ -1477,7 +1477,7 @@ internal static extern unsafe int git_repository_set_ident(
14771477

14781478

14791479
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
1480-
internal static extern unsafe void git_repository_set_index(
1480+
internal static extern unsafe int git_repository_set_index(
14811481
git_repository* repository,
14821482
git_index* index);
14831483

@@ -1559,13 +1559,13 @@ internal static extern unsafe int git_revparse_ext(
15591559
internal static extern unsafe int git_revwalk_push(git_revwalk* walker, ref GitOid id);
15601560

15611561
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
1562-
internal static extern unsafe void git_revwalk_reset(git_revwalk* walker);
1562+
internal static extern unsafe int git_revwalk_reset(git_revwalk* walker);
15631563

15641564
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
1565-
internal static extern unsafe void git_revwalk_sorting(git_revwalk* walk, CommitSortStrategies sort);
1565+
internal static extern unsafe int git_revwalk_sorting(git_revwalk* walk, CommitSortStrategies sort);
15661566

15671567
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
1568-
internal static extern unsafe void git_revwalk_simplify_first_parent(git_revwalk* walk);
1568+
internal static extern unsafe int git_revwalk_simplify_first_parent(git_revwalk* walk);
15691569

15701570
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
15711571
internal static extern unsafe void git_signature_free(git_signature* signature);

LibGit2Sharp/Core/Proxy.cs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,34 @@ public static unsafe BlameHandle git_blame_file(
3636

3737
#region git_blob_
3838

39-
public static unsafe IntPtr git_blob_create_fromstream(RepositoryHandle repo, string hintpath)
39+
public static unsafe IntPtr git_blob_create_from_stream(RepositoryHandle repo, string hintpath)
4040
{
4141
IntPtr writestream_ptr;
4242

43-
Ensure.ZeroResult(NativeMethods.git_blob_create_fromstream(out writestream_ptr, repo, hintpath));
43+
Ensure.ZeroResult(NativeMethods.git_blob_create_from_stream(out writestream_ptr, repo, hintpath));
4444
return writestream_ptr;
4545
}
4646

4747
public static unsafe ObjectId git_blob_create_fromstream_commit(IntPtr writestream_ptr)
4848
{
4949
var oid = new GitOid();
50-
Ensure.ZeroResult(NativeMethods.git_blob_create_fromstream_commit(ref oid, writestream_ptr));
50+
Ensure.ZeroResult(NativeMethods.git_blob_create_from_stream_commit(ref oid, writestream_ptr));
5151
return oid;
5252
}
5353

54-
public static unsafe ObjectId git_blob_create_fromdisk(RepositoryHandle repo, FilePath path)
54+
public static unsafe ObjectId git_blob_create_from_disk(RepositoryHandle repo, FilePath path)
5555
{
5656
var oid = new GitOid();
57-
int res = NativeMethods.git_blob_create_fromdisk(ref oid, repo, path);
57+
int res = NativeMethods.git_blob_create_from_disk(ref oid, repo, path);
5858
Ensure.ZeroResult(res);
5959

6060
return oid;
6161
}
6262

63-
public static unsafe ObjectId git_blob_create_fromfile(RepositoryHandle repo, FilePath path)
63+
public static unsafe ObjectId git_blob_create_from_workdir(RepositoryHandle repo, FilePath path)
6464
{
6565
var oid = new GitOid();
66-
int res = NativeMethods.git_blob_create_fromworkdir(ref oid, repo, path);
66+
int res = NativeMethods.git_blob_create_from_workdir(ref oid, repo, path);
6767
Ensure.ZeroResult(res);
6868

6969
return oid;
@@ -847,21 +847,22 @@ public static unsafe int git_diff_num_deltas(DiffHandle diff)
847847

848848
#region git_error_
849849

850-
public static void git_error_set_str(GitErrorCategory error_class, Exception exception)
850+
public static int git_error_set_str(GitErrorCategory error_class, Exception exception)
851851
{
852852
if (exception is OutOfMemoryException)
853853
{
854854
NativeMethods.git_error_set_oom();
855+
return 0;
855856
}
856857
else
857858
{
858-
NativeMethods.git_error_set_str(error_class, ErrorMessageFromException(exception));
859+
return NativeMethods.git_error_set_str(error_class, ErrorMessageFromException(exception));
859860
}
860861
}
861862

862-
public static void git_error_set_str(GitErrorCategory error_class, String errorString)
863+
public static int git_error_set_str(GitErrorCategory error_class, String errorString)
863864
{
864-
NativeMethods.git_error_set_str(error_class, errorString);
865+
return NativeMethods.git_error_set_str(error_class, errorString);
865866
}
866867

867868
/// <summary>
@@ -2581,9 +2582,9 @@ public static unsafe FilePath git_repository_path(RepositoryHandle repo)
25812582
return NativeMethods.git_repository_path(repo);
25822583
}
25832584

2584-
public static unsafe void git_repository_set_config(RepositoryHandle repo, ConfigurationHandle config)
2585+
public static unsafe int git_repository_set_config(RepositoryHandle repo, ConfigurationHandle config)
25852586
{
2586-
NativeMethods.git_repository_set_config(repo, config);
2587+
return NativeMethods.git_repository_set_config(repo, config);
25872588
}
25882589

25892590
public static unsafe void git_repository_set_ident(RepositoryHandle repo, string name, string email)
@@ -2592,9 +2593,9 @@ public static unsafe void git_repository_set_ident(RepositoryHandle repo, string
25922593
Ensure.ZeroResult(res);
25932594
}
25942595

2595-
public static unsafe void git_repository_set_index(RepositoryHandle repo, IndexHandle index)
2596+
public static unsafe int git_repository_set_index(RepositoryHandle repo, IndexHandle index)
25962597
{
2597-
NativeMethods.git_repository_set_index(repo, index);
2598+
return NativeMethods.git_repository_set_index(repo, index);
25982599
}
25992600

26002601
public static unsafe void git_repository_set_workdir(RepositoryHandle repo, FilePath workdir)
@@ -2775,14 +2776,14 @@ public static unsafe void git_revwalk_reset(RevWalkerHandle walker)
27752776
NativeMethods.git_revwalk_reset(walker);
27762777
}
27772778

2778-
public static unsafe void git_revwalk_sorting(RevWalkerHandle walker, CommitSortStrategies options)
2779+
public static unsafe int git_revwalk_sorting(RevWalkerHandle walker, CommitSortStrategies options)
27792780
{
2780-
NativeMethods.git_revwalk_sorting(walker, options);
2781+
return NativeMethods.git_revwalk_sorting(walker, options);
27812782
}
27822783

2783-
public static unsafe void git_revwalk_simplify_first_parent(RevWalkerHandle walker)
2784+
public static unsafe int git_revwalk_simplify_first_parent(RevWalkerHandle walker)
27842785
{
2785-
NativeMethods.git_revwalk_simplify_first_parent(walker);
2786+
return NativeMethods.git_revwalk_simplify_first_parent(walker);
27862787
}
27872788

27882789
#endregion

LibGit2Sharp/ObjectDatabase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public virtual Blob CreateBlob(string path)
104104
}
105105

106106
ObjectId id = Path.IsPathRooted(path)
107-
? Proxy.git_blob_create_fromdisk(repo.Handle, path)
108-
: Proxy.git_blob_create_fromfile(repo.Handle, path);
107+
? Proxy.git_blob_create_from_disk(repo.Handle, path)
108+
: Proxy.git_blob_create_from_workdir(repo.Handle, path);
109109

110110
return repo.Lookup<Blob>(id);
111111
}
@@ -277,7 +277,7 @@ private unsafe Blob CreateBlob(Stream stream, string hintpath, long? numberOfByt
277277
throw new ArgumentException("The stream cannot be read from.", "stream");
278278
}
279279

280-
IntPtr writestream_ptr = Proxy.git_blob_create_fromstream(repo.Handle, hintpath);
280+
IntPtr writestream_ptr = Proxy.git_blob_create_from_stream(repo.Handle, hintpath);
281281
GitWriteStream writestream = Marshal.PtrToStructure<GitWriteStream>(writestream_ptr);
282282

283283
try

0 commit comments

Comments
 (0)