Skip to content

Commit 9cdc883

Browse files
authored
Merge pull request #1661 from libgit2/ethomson/0_28pre1
Update libgit2 to v0.28.0-pre1
2 parents 0dcaefc + ba308b8 commit 9cdc883

22 files changed

+536
-471
lines changed

LibGit2Sharp/Core/Ensure.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private static unsafe void HandleError(int result)
134134
{
135135
string errorMessage;
136136
GitErrorCategory errorCategory = GitErrorCategory.Unknown;
137-
GitError* error = NativeMethods.giterr_last();
137+
GitError* error = NativeMethods.git_error_last();
138138

139139
if (error == null)
140140
{

LibGit2Sharp/Core/GitBuf.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal class GitBuf : IDisposable
1212

1313
public void Dispose()
1414
{
15-
Proxy.git_buf_free(this);
15+
Proxy.git_buf_dispose(this);
1616
}
1717
}
1818
}

LibGit2Sharp/Core/GitCheckoutOpts.cs

+3
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ internal enum CheckoutStrategy
118118
GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1 << 17),
119119
}
120120

121+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
121122
internal delegate int checkout_notify_cb(
122123
CheckoutNotifyFlags why,
123124
IntPtr path,
@@ -126,12 +127,14 @@ internal delegate int checkout_notify_cb(
126127
IntPtr workdir,
127128
IntPtr payload);
128129

130+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
129131
internal delegate void progress_cb(
130132
IntPtr strPtr,
131133
UIntPtr completed_steps,
132134
UIntPtr total_steps,
133135
IntPtr payload);
134136

137+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
135138
internal delegate int perfdata_cb(
136139
IntPtr perfdata,
137140
IntPtr payload);

LibGit2Sharp/Core/GitDiff.cs

+2
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,14 @@ internal enum GitDiffOptionFlags
198198
GIT_DIFF_SHOW_BINARY = (1 << 30),
199199
}
200200

201+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
201202
internal delegate int diff_notify_cb(
202203
IntPtr diff_so_far,
203204
IntPtr delta_to_add,
204205
IntPtr matched_pathspec,
205206
IntPtr payload);
206207

208+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
207209
internal delegate int diff_progress_cb(
208210
IntPtr diff_so_far,
209211
IntPtr old_path,

LibGit2Sharp/Core/GitFilter.cs

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ internal class GitFilter
4343
/// before the first use of the filter, so you can defer expensive
4444
/// initialization operations (in case libgit2 is being used in a way that doesn't need the filter).
4545
/// </summary>
46+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
4647
public delegate int git_filter_init_fn(IntPtr filter);
4748

4849
/// <summary>
@@ -53,6 +54,7 @@ internal class GitFilter
5354
/// will be called once at most and should release resources as needed.
5455
/// Typically this function will free the `git_filter` object itself.
5556
/// </summary>
57+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
5658
public delegate void git_filter_shutdown_fn(IntPtr filter);
5759

5860
/// <summary>
@@ -69,6 +71,7 @@ internal class GitFilter
6971
/// away before the `apply` callback can use it. If a filter allocates and assigns a value to the `payload`, it will need a `cleanup`
7072
/// callback to free the payload.
7173
/// </summary>
74+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
7275
public delegate int git_filter_check_fn(
7376
GitFilter gitFilter,
7477
IntPtr payload,
@@ -85,13 +88,15 @@ public delegate int git_filter_check_fn(
8588
///
8689
/// The `payload` value will refer to any payload that was set by the `check` callback. It may be read from or written to as needed.
8790
/// </summary>
91+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
8892
public delegate int git_filter_apply_fn(
8993
GitFilter gitFilter,
9094
IntPtr payload,
9195
IntPtr gitBufTo,
9296
IntPtr gitBufFrom,
9397
IntPtr filterSource);
9498

99+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
95100
public delegate int git_filter_stream_fn(
96101
out IntPtr git_writestream_out,
97102
GitFilter self,
@@ -104,6 +109,7 @@ public delegate int git_filter_stream_fn(
104109
/// after the filter has been applied. If the `check` or `apply` callbacks allocated a `payload`
105110
/// to keep per-source filter state, use this callback to free that payload and release resources as required.
106111
/// </summary>
112+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
107113
public delegate void git_filter_cleanup_fn(IntPtr gitFilter, IntPtr payload);
108114
}
109115
/// <summary>

LibGit2Sharp/Core/GitOdbBackend.cs

+11
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static GitOdbBackend()
5555
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
5656
/// <param name="oid">[in] The OID which the backend is being asked to look up.</param>
5757
/// <returns>0 if successful; an error code otherwise.</returns>
58+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
5859
public delegate int read_callback(
5960
out IntPtr buffer_p,
6061
out UIntPtr len_p,
@@ -77,6 +78,7 @@ public delegate int read_callback(
7778
/// <param name="short_oid">[in] The short-form OID which the backend is being asked to look up.</param>
7879
/// <param name="len">[in] The length of the short-form OID (short_oid).</param>
7980
/// <returns>0 if successful; an error code otherwise.</returns>
81+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
8082
public delegate int read_prefix_callback(
8183
out GitOid out_oid,
8284
out IntPtr buffer_p,
@@ -95,6 +97,7 @@ public delegate int read_prefix_callback(
9597
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
9698
/// <param name="oid">[in] The OID which the backend is being asked to look up.</param>
9799
/// <returns>0 if successful; an error code otherwise.</returns>
100+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
98101
public delegate int read_header_callback(
99102
out UIntPtr len_p,
100103
out GitObjectType type_p,
@@ -111,6 +114,7 @@ public delegate int read_header_callback(
111114
/// <param name="len">[in] The length of the buffer pointed to by data.</param>
112115
/// <param name="type">[in] The type of the object.</param>
113116
/// <returns>0 if successful; an error code otherwise.</returns>
117+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
114118
public delegate int write_callback(
115119
IntPtr backend,
116120
ref GitOid oid,
@@ -128,6 +132,7 @@ public delegate int write_callback(
128132
/// <param name="length">[in] The length of the object's contents.</param>
129133
/// <param name="type">[in] The type of the object being written.</param>
130134
/// <returns>0 if successful; an error code otherwise.</returns>
135+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
131136
public delegate int writestream_callback(
132137
out IntPtr stream_out,
133138
IntPtr backend,
@@ -142,6 +147,7 @@ public delegate int writestream_callback(
142147
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
143148
/// <param name="oid">[in] The object ID that the caller is requesting.</param>
144149
/// <returns>0 if successful; an error code otherwise.</returns>
150+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
145151
public delegate int readstream_callback(
146152
out IntPtr stream_out,
147153
IntPtr backend,
@@ -154,6 +160,7 @@ public delegate int readstream_callback(
154160
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
155161
/// <param name="oid">[in] The object ID that the caller is requesting.</param>
156162
/// <returns>True if the object exists; false otherwise</returns>
163+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
157164
public delegate bool exists_callback(
158165
IntPtr backend,
159166
ref GitOid oid);
@@ -169,6 +176,7 @@ public delegate bool exists_callback(
169176
/// <param name="short_oid">[in] The short-form OID which the backend is being asked to look up.</param>
170177
/// <param name="len">[in] The length of the short-form OID (short_oid).</param>
171178
/// <returns>1 if the object exists, 0 if the object doesn't; an error code otherwise.</returns>
179+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
172180
public delegate int exists_prefix_callback(
173181
ref GitOid found_oid,
174182
IntPtr backend,
@@ -182,6 +190,7 @@ public delegate int exists_prefix_callback(
182190
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
183191
/// <param name="cb">[in] The callback function to invoke.</param>
184192
/// <param name="data">[in] An arbitrary parameter to pass through to the callback</param>
193+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
185194
public delegate int foreach_callback(
186195
IntPtr backend,
187196
foreach_callback_callback cb,
@@ -191,6 +200,7 @@ public delegate int foreach_callback(
191200
/// The owner of this backend is finished with it. The backend is asked to clean up and shut down.
192201
/// </summary>
193202
/// <param name="backend">[in] A pointer to the backend which is being freed.</param>
203+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
194204
public delegate void free_callback(
195205
IntPtr backend);
196206

@@ -200,6 +210,7 @@ public delegate void free_callback(
200210
/// <param name="oid">The oid of each object in the backing store.</param>
201211
/// <param name="data">The arbitrary parameter given to foreach_callback.</param>
202212
/// <returns>A non-negative result indicates the enumeration should continue. Otherwise, the enumeration should stop.</returns>
213+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
203214
public delegate int foreach_callback_callback(
204215
IntPtr oid,
205216
IntPtr data);

LibGit2Sharp/Core/GitOdbBackendStream.cs

+4
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,22 @@ static GitOdbBackendStream()
3838

3939
public static int GCHandleOffset;
4040

41+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
4142
public delegate int read_callback(
4243
IntPtr stream,
4344
IntPtr buffer,
4445
UIntPtr len);
4546

47+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
4648
public delegate int write_callback(
4749
IntPtr stream,
4850
IntPtr buffer,
4951
UIntPtr len);
5052

53+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
5154
public delegate int finalize_write_callback(IntPtr stream, ref GitOid oid);
5255

56+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
5357
public delegate void free_callback(IntPtr stream);
5458
}
5559
}

LibGit2Sharp/Core/GitSmartSubtransport.cs

+3
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@ static GitSmartSubtransport()
2323

2424
public static int GCHandleOffset;
2525

26+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
2627
public delegate int action_callback(
2728
out IntPtr stream,
2829
IntPtr subtransport,
2930
IntPtr url,
3031
GitSmartSubtransportAction action);
3132

33+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
3234
public delegate int close_callback(IntPtr subtransport);
3335

36+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
3437
public delegate void free_callback(IntPtr subtransport);
3538
}
3639
}

LibGit2Sharp/Core/GitSmartSubtransportRegistration.cs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ internal class GitSmartSubtransportRegistration
1010
public uint Rpc;
1111
public uint Param;
1212

13+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
1314
public delegate int create_callback(
1415
out IntPtr subtransport,
1516
IntPtr owner,

LibGit2Sharp/Core/GitSmartSubtransportStream.cs

+3
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,20 @@ static GitSmartSubtransportStream()
2525

2626
public static int GCHandleOffset;
2727

28+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
2829
public delegate int read_callback(
2930
IntPtr stream,
3031
IntPtr buffer,
3132
UIntPtr buf_size,
3233
out UIntPtr bytes_read);
3334

35+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
3436
public delegate int write_callback(
3537
IntPtr stream,
3638
IntPtr buffer,
3739
UIntPtr len);
3840

41+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
3942
public delegate void free_callback(IntPtr stream);
4043
}
4144
}

LibGit2Sharp/Core/GitStashApplyOpts.cs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace LibGit2Sharp.Core
55
{
6+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
67
internal delegate int stash_apply_progress_cb(StashApplyProgress progress, IntPtr payload);
78

89
[StructLayout(LayoutKind.Sequential)]

LibGit2Sharp/Core/GitWriteStream.cs

+5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ internal struct GitWriteStream
1515
[MarshalAs(UnmanagedType.FunctionPtr)]
1616
public free_fn free;
1717

18+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
1819
public delegate int write_fn(IntPtr stream, IntPtr buffer, UIntPtr len);
20+
21+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
1922
public delegate int close_fn(IntPtr stream);
23+
24+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
2025
public delegate void free_fn(IntPtr stream);
2126
}
2227
}

0 commit comments

Comments
 (0)