Skip to content

Commit

Permalink
Merge pull request #1661 from libgit2/ethomson/0_28pre1
Browse files Browse the repository at this point in the history
Update libgit2 to v0.28.0-pre1
  • Loading branch information
ethomson committed Feb 6, 2019
2 parents 0dcaefc + ba308b8 commit 9cdc883
Show file tree
Hide file tree
Showing 22 changed files with 536 additions and 471 deletions.
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/Ensure.cs
Expand Up @@ -134,7 +134,7 @@ private static unsafe void HandleError(int result)
{
string errorMessage;
GitErrorCategory errorCategory = GitErrorCategory.Unknown;
GitError* error = NativeMethods.giterr_last();
GitError* error = NativeMethods.git_error_last();

if (error == null)
{
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/GitBuf.cs
Expand Up @@ -12,7 +12,7 @@ internal class GitBuf : IDisposable

public void Dispose()
{
Proxy.git_buf_free(this);
Proxy.git_buf_dispose(this);
}
}
}
3 changes: 3 additions & 0 deletions LibGit2Sharp/Core/GitCheckoutOpts.cs
Expand Up @@ -118,6 +118,7 @@ internal enum CheckoutStrategy
GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1 << 17),
}

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int checkout_notify_cb(
CheckoutNotifyFlags why,
IntPtr path,
Expand All @@ -126,12 +127,14 @@ internal enum CheckoutStrategy
IntPtr workdir,
IntPtr payload);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void progress_cb(
IntPtr strPtr,
UIntPtr completed_steps,
UIntPtr total_steps,
IntPtr payload);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int perfdata_cb(
IntPtr perfdata,
IntPtr payload);
Expand Down
2 changes: 2 additions & 0 deletions LibGit2Sharp/Core/GitDiff.cs
Expand Up @@ -198,12 +198,14 @@ internal enum GitDiffOptionFlags
GIT_DIFF_SHOW_BINARY = (1 << 30),
}

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int diff_notify_cb(
IntPtr diff_so_far,
IntPtr delta_to_add,
IntPtr matched_pathspec,
IntPtr payload);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int diff_progress_cb(
IntPtr diff_so_far,
IntPtr old_path,
Expand Down
6 changes: 6 additions & 0 deletions LibGit2Sharp/Core/GitFilter.cs
Expand Up @@ -43,6 +43,7 @@ internal class GitFilter
/// before the first use of the filter, so you can defer expensive
/// initialization operations (in case libgit2 is being used in a way that doesn't need the filter).
/// </summary>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int git_filter_init_fn(IntPtr filter);

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

/// <summary>
Expand All @@ -69,6 +71,7 @@ internal class GitFilter
/// away before the `apply` callback can use it. If a filter allocates and assigns a value to the `payload`, it will need a `cleanup`
/// callback to free the payload.
/// </summary>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int git_filter_check_fn(
GitFilter gitFilter,
IntPtr payload,
Expand All @@ -85,13 +88,15 @@ internal class GitFilter
///
/// 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.
/// </summary>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int git_filter_apply_fn(
GitFilter gitFilter,
IntPtr payload,
IntPtr gitBufTo,
IntPtr gitBufFrom,
IntPtr filterSource);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int git_filter_stream_fn(
out IntPtr git_writestream_out,
GitFilter self,
Expand All @@ -104,6 +109,7 @@ internal class GitFilter
/// after the filter has been applied. If the `check` or `apply` callbacks allocated a `payload`
/// to keep per-source filter state, use this callback to free that payload and release resources as required.
/// </summary>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void git_filter_cleanup_fn(IntPtr gitFilter, IntPtr payload);
}
/// <summary>
Expand Down
11 changes: 11 additions & 0 deletions LibGit2Sharp/Core/GitOdbBackend.cs
Expand Up @@ -55,6 +55,7 @@ static GitOdbBackend()
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
/// <param name="oid">[in] The OID which the backend is being asked to look up.</param>
/// <returns>0 if successful; an error code otherwise.</returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int read_callback(
out IntPtr buffer_p,
out UIntPtr len_p,
Expand All @@ -77,6 +78,7 @@ static GitOdbBackend()
/// <param name="short_oid">[in] The short-form OID which the backend is being asked to look up.</param>
/// <param name="len">[in] The length of the short-form OID (short_oid).</param>
/// <returns>0 if successful; an error code otherwise.</returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int read_prefix_callback(
out GitOid out_oid,
out IntPtr buffer_p,
Expand All @@ -95,6 +97,7 @@ static GitOdbBackend()
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
/// <param name="oid">[in] The OID which the backend is being asked to look up.</param>
/// <returns>0 if successful; an error code otherwise.</returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int read_header_callback(
out UIntPtr len_p,
out GitObjectType type_p,
Expand All @@ -111,6 +114,7 @@ static GitOdbBackend()
/// <param name="len">[in] The length of the buffer pointed to by data.</param>
/// <param name="type">[in] The type of the object.</param>
/// <returns>0 if successful; an error code otherwise.</returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int write_callback(
IntPtr backend,
ref GitOid oid,
Expand All @@ -128,6 +132,7 @@ static GitOdbBackend()
/// <param name="length">[in] The length of the object's contents.</param>
/// <param name="type">[in] The type of the object being written.</param>
/// <returns>0 if successful; an error code otherwise.</returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int writestream_callback(
out IntPtr stream_out,
IntPtr backend,
Expand All @@ -142,6 +147,7 @@ static GitOdbBackend()
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
/// <param name="oid">[in] The object ID that the caller is requesting.</param>
/// <returns>0 if successful; an error code otherwise.</returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int readstream_callback(
out IntPtr stream_out,
IntPtr backend,
Expand All @@ -154,6 +160,7 @@ static GitOdbBackend()
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
/// <param name="oid">[in] The object ID that the caller is requesting.</param>
/// <returns>True if the object exists; false otherwise</returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool exists_callback(
IntPtr backend,
ref GitOid oid);
Expand All @@ -169,6 +176,7 @@ static GitOdbBackend()
/// <param name="short_oid">[in] The short-form OID which the backend is being asked to look up.</param>
/// <param name="len">[in] The length of the short-form OID (short_oid).</param>
/// <returns>1 if the object exists, 0 if the object doesn't; an error code otherwise.</returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int exists_prefix_callback(
ref GitOid found_oid,
IntPtr backend,
Expand All @@ -182,6 +190,7 @@ static GitOdbBackend()
/// <param name="backend">[in] A pointer to the backend which is being asked to perform the task.</param>
/// <param name="cb">[in] The callback function to invoke.</param>
/// <param name="data">[in] An arbitrary parameter to pass through to the callback</param>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int foreach_callback(
IntPtr backend,
foreach_callback_callback cb,
Expand All @@ -191,6 +200,7 @@ static GitOdbBackend()
/// The owner of this backend is finished with it. The backend is asked to clean up and shut down.
/// </summary>
/// <param name="backend">[in] A pointer to the backend which is being freed.</param>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void free_callback(
IntPtr backend);

Expand All @@ -200,6 +210,7 @@ static GitOdbBackend()
/// <param name="oid">The oid of each object in the backing store.</param>
/// <param name="data">The arbitrary parameter given to foreach_callback.</param>
/// <returns>A non-negative result indicates the enumeration should continue. Otherwise, the enumeration should stop.</returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int foreach_callback_callback(
IntPtr oid,
IntPtr data);
Expand Down
4 changes: 4 additions & 0 deletions LibGit2Sharp/Core/GitOdbBackendStream.cs
Expand Up @@ -38,18 +38,22 @@ static GitOdbBackendStream()

public static int GCHandleOffset;

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int read_callback(
IntPtr stream,
IntPtr buffer,
UIntPtr len);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int write_callback(
IntPtr stream,
IntPtr buffer,
UIntPtr len);

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

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void free_callback(IntPtr stream);
}
}
3 changes: 3 additions & 0 deletions LibGit2Sharp/Core/GitSmartSubtransport.cs
Expand Up @@ -23,14 +23,17 @@ static GitSmartSubtransport()

public static int GCHandleOffset;

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int action_callback(
out IntPtr stream,
IntPtr subtransport,
IntPtr url,
GitSmartSubtransportAction action);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int close_callback(IntPtr subtransport);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void free_callback(IntPtr subtransport);
}
}
1 change: 1 addition & 0 deletions LibGit2Sharp/Core/GitSmartSubtransportRegistration.cs
Expand Up @@ -10,6 +10,7 @@ internal class GitSmartSubtransportRegistration
public uint Rpc;
public uint Param;

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int create_callback(
out IntPtr subtransport,
IntPtr owner,
Expand Down
3 changes: 3 additions & 0 deletions LibGit2Sharp/Core/GitSmartSubtransportStream.cs
Expand Up @@ -25,17 +25,20 @@ static GitSmartSubtransportStream()

public static int GCHandleOffset;

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int read_callback(
IntPtr stream,
IntPtr buffer,
UIntPtr buf_size,
out UIntPtr bytes_read);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int write_callback(
IntPtr stream,
IntPtr buffer,
UIntPtr len);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void free_callback(IntPtr stream);
}
}
1 change: 1 addition & 0 deletions LibGit2Sharp/Core/GitStashApplyOpts.cs
Expand Up @@ -3,6 +3,7 @@

namespace LibGit2Sharp.Core
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int stash_apply_progress_cb(StashApplyProgress progress, IntPtr payload);

[StructLayout(LayoutKind.Sequential)]
Expand Down
5 changes: 5 additions & 0 deletions LibGit2Sharp/Core/GitWriteStream.cs
Expand Up @@ -15,8 +15,13 @@ internal struct GitWriteStream
[MarshalAs(UnmanagedType.FunctionPtr)]
public free_fn free;

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int write_fn(IntPtr stream, IntPtr buffer, UIntPtr len);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int close_fn(IntPtr stream);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void free_fn(IntPtr stream);
}
}

0 comments on commit 9cdc883

Please sign in to comment.