1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

libgit updates

This commit is contained in:
Brian Fiete 2024-10-21 09:14:34 -04:00
parent e7ede593ea
commit 78138f5c5a
2 changed files with 295 additions and 31 deletions

View file

@ -2,4 +2,11 @@ FileVersion = 1
[Project] [Project]
Name = "libgit2" Name = "libgit2"
TargetType = "BeefLib"
[Configs.Debug.Win64]
LibPaths = ["$(ProjectDir)/dist/git2.lib"]
PostBuildCmds = ["CopyToDependents(\"$(ProjectDir)/dist/*.dll\")"]
[Configs.Release.Win64]
LibPaths = ["$(ProjectDir)/dist/git2.lib"]
PostBuildCmds = ["CopyToDependents(\"$(ProjectDir)/dist/*.dll\")"]

View file

@ -10,7 +10,7 @@ using System;
namespace Git namespace Git
{ {
class GitApi static class GitApi
{ {
public struct git_repository; public struct git_repository;
public struct git_worktree; public struct git_worktree;
@ -24,7 +24,6 @@ namespace Git
public struct git_remote; public struct git_remote;
public struct git_object; public struct git_object;
public struct git_refspec; public struct git_refspec;
public struct git_proxy_options;
public struct git_transport; public struct git_transport;
public struct git_packbuilder; public struct git_packbuilder;
public struct git_revwalk; public struct git_revwalk;
@ -32,7 +31,131 @@ namespace Git
public struct git_tree; public struct git_tree;
public struct git_tag; public struct git_tag;
/** Generic return codes */
public enum git_error_code : c_int
{
GIT_OK = 0, /**< No error */
GIT_ERROR = -1, /**< Generic error */
GIT_ENOTFOUND = -3, /**< Requested object could not be found */
GIT_EEXISTS = -4, /**< Object exists preventing operation */
GIT_EAMBIGUOUS = -5, /**< More than one object matches */
GIT_EBUFS = -6, /**< Output buffer too short to hold data */
/**
* GIT_EUSER is a special error that is never generated by libgit2
* code. You can return it from a callback (e.g to stop an iteration)
* to know that it was generated by the callback and not by libgit2.
*/
GIT_EUSER = -7,
GIT_EBAREREPO = -8, /**< Operation not allowed on bare repository */
GIT_EUNBORNBRANCH = -9, /**< HEAD refers to branch with no commits */
GIT_EUNMERGED = -10, /**< Merge in progress prevented operation */
GIT_ENONFASTFORWARD = -11, /**< Reference was not fast-forwardable */
GIT_EINVALIDSPEC = -12, /**< Name/ref spec was not in a valid format */
GIT_ECONFLICT = -13, /**< Checkout conflicts prevented operation */
GIT_ELOCKED = -14, /**< Lock file prevented operation */
GIT_EMODIFIED = -15, /**< Reference value does not match expected */
GIT_EAUTH = -16, /**< Authentication error */
GIT_ECERTIFICATE = -17, /**< Server certificate is invalid */
GIT_EAPPLIED = -18, /**< Patch/merge has already been applied */
GIT_EPEEL = -19, /**< The requested peel operation is not possible */
GIT_EEOF = -20, /**< Unexpected EOF */
GIT_EINVALID = -21, /**< Invalid operation or input */
GIT_EUNCOMMITTED = -22, /**< Uncommitted changes in index prevented operation */
GIT_EDIRECTORY = -23, /**< The operation is not valid for a directory */
GIT_EMERGECONFLICT = -24, /**< A merge conflict exists and cannot continue */
GIT_PASSTHROUGH = -30, /**< A user-configured callback refused to act */
GIT_ITEROVER = -31, /**< Signals end of iteration with iterator */
GIT_RETRY = -32, /**< Internal only */
GIT_EMISMATCH = -33, /**< Hashsum mismatch in object */
GIT_EINDEXDIRTY = -34, /**< Unsaved changes in the index would be overwritten */
GIT_EAPPLYFAIL = -35, /**< Patch application failed */
GIT_EOWNER = -36, /**< The object is not owned by the current user */
GIT_TIMEOUT = -37, /**< The operation timed out */
GIT_EUNCHANGED = -38, /**< There were no changes */
GIT_ENOTSUPPORTED = -39, /**< An option is not supported */
GIT_EREADONLY = -40 /**< The subject is read-only */
}
/**
* The type of proxy to use.
*/
public enum git_proxy_t : c_int
{
/**
* Do not attempt to connect through a proxy
*
* If built against libcurl, it itself may attempt to connect
* to a proxy if the environment variables specify it.
*/
GIT_PROXY_NONE,
/**
* Try to auto-detect the proxy from the git configuration.
*/
GIT_PROXY_AUTO,
/**
* Connect via the URL given in the options
*/
GIT_PROXY_SPECIFIED
}
/**
* Options for connecting through a proxy
*
* Note that not all types may be supported, depending on the platform
* and compilation options.
*/
[CRepr]
public struct git_proxy_options
{
public c_int version;
/**
* The type of proxy to use, by URL, auto-detect.
*/
public git_proxy_t type;
/**
* The URL of the proxy.
*/
public char8* url;
/**
* This will be called if the remote host requires
* authentication in order to connect to it.
*
* Returning GIT_PASSTHROUGH will make libgit2 behave as
* though this field isn't set.
*/
public git_credential_acquire_cb credentials;
/**
* If cert verification fails, this will be called to let the
* user make the final decision of whether to allow the
* connection to proceed. Returns 0 to allow the connection
* or a negative value to indicate an error.
*/
public git_transport_certificate_check_cb certificate_check;
/**
* Payload to be provided to the credentials and certificate
* check callbacks.
*/
public void *payload;
}
const int GIT_PROXY_OPTIONS_VERSION = 1;
public static git_proxy_options GIT_PROXY_OPTIONS_INIT = .()
{
version = GIT_PROXY_OPTIONS_VERSION
};
/** Time in a signature */ /** Time in a signature */
[CRepr]
public struct git_time public struct git_time
{ {
int64 time; /**< time in seconds from epoch */ int64 time; /**< time in seconds from epoch */
@ -54,6 +177,7 @@ namespace Git
} }
/** An action signature (e.g. for committers, taggers, etc) */ /** An action signature (e.g. for committers, taggers, etc) */
[CRepr]
public struct git_signature public struct git_signature
{ {
char8 *name; /**< full name of the author */ char8 *name; /**< full name of the author */
@ -688,6 +812,7 @@ namespace Git
const int GIT_OID_MINPREFIXLEN = 4; const int GIT_OID_MINPREFIXLEN = 4;
/** Unique identity of any object (commit, tree, blob, tag). */ /** Unique identity of any object (commit, tree, blob, tag). */
[CRepr]
public struct git_oid public struct git_oid
{ {
/** raw binary formatted id */ /** raw binary formatted id */
@ -940,6 +1065,7 @@ namespace Git
* progress of indexing a packfile, either directly or part of a * progress of indexing a packfile, either directly or part of a
* fetch or clone that downloads a packfile. * fetch or clone that downloads a packfile.
*/ */
[CRepr]
public struct git_indexer_progress public struct git_indexer_progress
{ {
/** number of objects in the packfile being indexed */ /** number of objects in the packfile being indexed */
@ -979,6 +1105,7 @@ namespace Git
/** /**
* Options for indexer configuration * Options for indexer configuration
*/ */
[CRepr]
public struct git_indexer_options public struct git_indexer_options
{ {
c_uint version; c_uint version;
@ -1097,6 +1224,7 @@ namespace Git
/** /**
* Parent type for `git_cert_hostkey` and `git_cert_x509`. * Parent type for `git_cert_hostkey` and `git_cert_x509`.
*/ */
[CRepr]
public struct git_cert { public struct git_cert {
/** /**
* Type of certificate. A `GIT_CERT_` value. * Type of certificate. A `GIT_CERT_` value.
@ -1133,6 +1261,7 @@ namespace Git
/** /**
* Hostkey information taken from libssh2 * Hostkey information taken from libssh2
*/ */
[CRepr]
public struct git_cert_hostkey public struct git_cert_hostkey
{ {
public git_cert parent; /**< The parent cert */ public git_cert parent; /**< The parent cert */
@ -1165,6 +1294,7 @@ namespace Git
/** /**
* X.509 certificate information * X.509 certificate information
*/ */
[CRepr]
public struct git_cert_x509 public struct git_cert_x509
{ {
git_cert parent; /**< The parent cert */ git_cert parent; /**< The parent cert */
@ -1476,11 +1606,13 @@ namespace Git
// transport.h // transport.h
//////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////
public function c_int git_transport_message_cb(char8 *str, int len, void *payload); public function c_int git_transport_message_cb(char8 *str, c_int len, void *payload);
/** Signature of a function which creates a transport */ /** Signature of a function which creates a transport */
public function c_int git_transport_cb(git_transport **outVal, git_remote *owner, void *param); public function c_int git_transport_cb(git_transport **outVal, git_remote *owner, void *param);
public function c_int git_remote_ready_cb(git_remote *remote, c_int direction, void *payload);
//////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////
// net.h // net.h
//////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1514,6 +1646,7 @@ namespace Git
//////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////
/** Array of strings */ /** Array of strings */
[CRepr]
public struct git_strarray public struct git_strarray
{ {
char8 **strings; char8 **strings;
@ -1692,6 +1825,7 @@ namespace Git
* or -1 if there was a repository but open failed for some reason * or -1 if there was a repository but open failed for some reason
* (such as repo corruption or system errors). * (such as repo corruption or system errors).
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_open_ext( public static extern int git_repository_open_ext(
git_repository** outVal, git_repository** outVal,
char8* path, char8* path,
@ -1709,6 +1843,7 @@ namespace Git
* @param bare_path Direct path to the bare repository * @param bare_path Direct path to the bare repository
* @return 0 on success, or an error code * @return 0 on success, or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_open_bare(git_repository** outVal, char8* bare_path); public static extern int git_repository_open_bare(git_repository** outVal, char8* bare_path);
/** /**
@ -1722,6 +1857,7 @@ namespace Git
* *
* @param repo repository handle to close. If NULL nothing occurs. * @param repo repository handle to close. If NULL nothing occurs.
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern void git_repository_free(git_repository *repo); public static extern void git_repository_free(git_repository *repo);
/** /**
@ -1739,6 +1875,7 @@ namespace Git
* *
* @return 0 or an error code * @return 0 or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_init( public static extern int git_repository_init(
git_repository** outVal, git_repository** outVal,
char8* path, char8* path,
@ -1856,6 +1993,7 @@ namespace Git
* @param version The struct version; pass `GIT_REPOSITORY_INIT_OPTIONS_VERSION`. * @param version The struct version; pass `GIT_REPOSITORY_INIT_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure. * @return Zero on success; -1 on failure.
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_init_options_init( public static extern int git_repository_init_options_init(
git_repository_init_options *opts, git_repository_init_options *opts,
c_uint version); c_uint version);
@ -1873,6 +2011,7 @@ namespace Git
* @param opts Pointer to git_repository_init_options struct. * @param opts Pointer to git_repository_init_options struct.
* @return 0 or an error code on failure. * @return 0 or an error code on failure.
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_init_ext( public static extern int git_repository_init_ext(
git_repository** outVal, git_repository** outVal,
char8* repo_path, char8* repo_path,
@ -1891,6 +2030,7 @@ namespace Git
* @return 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing * @return 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing
* branch, GIT_ENOTFOUND when HEAD is missing; an error code otherwise * branch, GIT_ENOTFOUND when HEAD is missing; an error code otherwise
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_head(git_reference** outVal, git_repository *repo); public static extern int git_repository_head(git_reference** outVal, git_repository *repo);
/** /**
@ -1901,6 +2041,7 @@ namespace Git
* @param name name of the worktree to retrieve HEAD for * @param name name of the worktree to retrieve HEAD for
* @return 0 when successful, error-code otherwise * @return 0 when successful, error-code otherwise
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_head_for_worktree(git_reference** outVal, git_repository *repo, public static extern int git_repository_head_for_worktree(git_reference** outVal, git_repository *repo,
char8* name); char8* name);
@ -1914,6 +2055,7 @@ namespace Git
* @return 1 if HEAD is detached, 0 if it's not; error code if there * @return 1 if HEAD is detached, 0 if it's not; error code if there
* was an error. * was an error.
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_head_detached(git_repository *repo); public static extern int git_repository_head_detached(git_repository *repo);
/** /**
@ -1927,6 +2069,7 @@ namespace Git
* @return 1 if HEAD is detached, 0 if its not; error code if * @return 1 if HEAD is detached, 0 if its not; error code if
* there was an error * there was an error
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_head_detached_for_worktree(git_repository *repo, public static extern int git_repository_head_detached_for_worktree(git_repository *repo,
char8* name); char8* name);
@ -1940,6 +2083,7 @@ namespace Git
* @return 1 if the current branch is unborn, 0 if it's not; error * @return 1 if the current branch is unborn, 0 if it's not; error
* code if there was an error * code if there was an error
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_head_unborn(git_repository *repo); public static extern int git_repository_head_unborn(git_repository *repo);
/** /**
@ -1952,6 +2096,7 @@ namespace Git
* @return 1 if the repository is empty, 0 if it isn't, error code * @return 1 if the repository is empty, 0 if it isn't, error code
* if the repository is corrupted * if the repository is corrupted
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_is_empty(git_repository *repo); public static extern int git_repository_is_empty(git_repository *repo);
/** /**
@ -1990,6 +2135,7 @@ namespace Git
* @param item The repository item for which to retrieve the path * @param item The repository item for which to retrieve the path
* @return 0, GIT_ENOTFOUND if the path cannot exist or an error code * @return 0, GIT_ENOTFOUND if the path cannot exist or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_item_path(git_buf *outVal, git_repository *repo, git_repository_item_t item); public static extern int git_repository_item_path(git_buf *outVal, git_repository *repo, git_repository_item_t item);
/** /**
@ -2001,6 +2147,7 @@ namespace Git
* @param repo A repository object * @param repo A repository object
* @return the path to the repository * @return the path to the repository
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern char8* git_repository_path(git_repository *repo); public static extern char8* git_repository_path(git_repository *repo);
/** /**
@ -2012,6 +2159,7 @@ namespace Git
* @param repo A repository object * @param repo A repository object
* @return the path to the working dir, if it exists * @return the path to the working dir, if it exists
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern char8* git_repository_workdir(git_repository* repo); public static extern char8* git_repository_workdir(git_repository* repo);
/** /**
@ -2024,6 +2172,7 @@ namespace Git
* @param repo A repository object * @param repo A repository object
* @return the path to the common dir * @return the path to the common dir
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern char8* git_repository_commondir(git_repository* repo); public static extern char8* git_repository_commondir(git_repository* repo);
/** /**
@ -2043,6 +2192,7 @@ namespace Git
* "core.worktree" (if workdir is not the parent of the .git directory) * "core.worktree" (if workdir is not the parent of the .git directory)
* @return 0, or an error code * @return 0, or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_set_workdir( public static extern int git_repository_set_workdir(
git_repository *repo, char8* workdir, int update_gitlink); git_repository *repo, char8* workdir, int update_gitlink);
@ -2052,6 +2202,7 @@ namespace Git
* @param repo Repo to test * @param repo Repo to test
* @return 1 if the repository is bare, 0 otherwise. * @return 1 if the repository is bare, 0 otherwise.
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_is_bare(git_repository* repo); public static extern int git_repository_is_bare(git_repository* repo);
/** /**
@ -2060,6 +2211,7 @@ namespace Git
* @param repo Repo to test * @param repo Repo to test
* @return 1 if the repository is a linked work tree, 0 otherwise. * @return 1 if the repository is a linked work tree, 0 otherwise.
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_is_worktree(git_repository* repo); public static extern int git_repository_is_worktree(git_repository* repo);
/** /**
@ -2076,6 +2228,7 @@ namespace Git
* @param repo A repository object * @param repo A repository object
* @return 0, or an error code * @return 0, or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_config(git_config** outVal, git_repository *repo); public static extern int git_repository_config(git_config** outVal, git_repository *repo);
/** /**
@ -2092,6 +2245,7 @@ namespace Git
* @param repo the repository * @param repo the repository
* @return 0, or an error code * @return 0, or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_config_snapshot(git_config** outVal, git_repository *repo); public static extern int git_repository_config_snapshot(git_config** outVal, git_repository *repo);
/** /**
@ -2108,6 +2262,7 @@ namespace Git
* @param repo A repository object * @param repo A repository object
* @return 0, or an error code * @return 0, or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_odb(git_odb** outVal, git_repository *repo); public static extern int git_repository_odb(git_odb** outVal, git_repository *repo);
/** /**
@ -2124,6 +2279,7 @@ namespace Git
* @param repo A repository object * @param repo A repository object
* @return 0, or an error code * @return 0, or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_refdb(git_refdb** outVal, git_repository *repo); public static extern int git_repository_refdb(git_refdb** outVal, git_repository *repo);
/** /**
@ -2140,6 +2296,7 @@ namespace Git
* @param repo A repository object * @param repo A repository object
* @return 0, or an error code * @return 0, or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_index(git_index** outVal, git_repository *repo); public static extern int git_repository_index(git_index** outVal, git_repository *repo);
/** /**
@ -2158,6 +2315,7 @@ namespace Git
* @param repo Repository to read prepared message from * @param repo Repository to read prepared message from
* @return 0, GIT_ENOTFOUND if no message exists or an error code * @return 0, GIT_ENOTFOUND if no message exists or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_message(git_buf* outVal, git_repository *repo); public static extern int git_repository_message(git_buf* outVal, git_repository *repo);
/** /**
@ -2165,6 +2323,7 @@ namespace Git
* *
* Remove the message that `git_repository_message` retrieves. * Remove the message that `git_repository_message` retrieves.
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_message_remove(git_repository *repo); public static extern int git_repository_message_remove(git_repository *repo);
/** /**
@ -2174,6 +2333,7 @@ namespace Git
* @param repo A repository object * @param repo A repository object
* @return 0 on success, or error * @return 0 on success, or error
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_state_cleanup(git_repository *repo); public static extern int git_repository_state_cleanup(git_repository *repo);
/** /**
@ -2205,6 +2365,7 @@ namespace Git
* @return 0 on success, non-zero callback return value, GIT_ENOTFOUND if * @return 0 on success, non-zero callback return value, GIT_ENOTFOUND if
* there is no FETCH_HEAD file, or other error code. * there is no FETCH_HEAD file, or other error code.
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_fetchhead_foreach( public static extern int git_repository_fetchhead_foreach(
git_repository *repo, git_repository *repo,
git_repository_fetchhead_foreach_cb callback, git_repository_fetchhead_foreach_cb callback,
@ -2233,6 +2394,7 @@ namespace Git
* @return 0 on success, non-zero callback return value, GIT_ENOTFOUND if * @return 0 on success, non-zero callback return value, GIT_ENOTFOUND if
* there is no MERGE_HEAD file, or other error code. * there is no MERGE_HEAD file, or other error code.
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_mergehead_foreach( public static extern int git_repository_mergehead_foreach(
git_repository *repo, git_repository *repo,
git_repository_mergehead_foreach_cb callback, git_repository_mergehead_foreach_cb callback,
@ -2261,6 +2423,7 @@ namespace Git
* applied when calculating the hash. * applied when calculating the hash.
* @return 0 on success, or an error code * @return 0 on success, or an error code
*/ */
[CLink, CallingConvention(.Stdcall)]
public static extern int git_repository_hashfile( public static extern int git_repository_hashfile(
git_oid *outVal, git_oid *outVal,
git_repository *repo, git_repository *repo,
@ -2474,7 +2637,9 @@ namespace Git
* use `git_remote_create_options_init`. * use `git_remote_create_options_init`.
* *
*/ */
public struct git_remote_create_options { [CRepr]
public struct git_remote_create_options
{
public c_uint version; public c_uint version;
/** /**
@ -2857,6 +3022,7 @@ namespace Git
/** /**
* Represents an update which will be performed on the remote during push * Represents an update which will be performed on the remote during push
*/ */
[CRepr]
public struct git_push_update public struct git_push_update
{ {
/** /**
@ -2921,7 +3087,8 @@ namespace Git
* Set the callbacks to be called by the remote when informing the user * Set the callbacks to be called by the remote when informing the user
* about the progress of the network operations. * about the progress of the network operations.
*/ */
struct git_remote_callbacks [CRepr]
public struct git_remote_callbacks
{ {
public c_uint version; /**< The version */ public c_uint version; /**< The version */
@ -3000,6 +3167,11 @@ namespace Git
*/ */
public git_transport_cb transport; public git_transport_cb transport;
/**
* Callback when the remote is ready to connect.
*/
public git_remote_ready_cb remote_ready;
/** /**
* This will be passed to each of the callbacks in this struct * This will be passed to each of the callbacks in this struct
* as the last parameter. * as the last parameter.
@ -3013,8 +3185,8 @@ namespace Git
public git_url_resolve_cb resolve_url; public git_url_resolve_cb resolve_url;
}; };
//#define GIT_REMOTE_CALLBACKS_VERSION 1 const int GIT_REMOTE_CALLBACKS_VERSION = 1;
//#define GIT_REMOTE_CALLBACKS_INIT {GIT_REMOTE_CALLBACKS_VERSION} public static git_remote_callbacks GIT_REMOTE_CALLBACKS_INIT = .(){ version = GIT_REMOTE_CALLBACKS_VERSION };
/** /**
* Initializes a `git_remote_callbacks` with default values. Equivalent to * Initializes a `git_remote_callbacks` with default values. Equivalent to
@ -3070,6 +3242,43 @@ namespace Git
GIT_REMOTE_DOWNLOAD_TAGS_ALL, GIT_REMOTE_DOWNLOAD_TAGS_ALL,
} }
/**
* How to handle reference updates.
*/
public enum git_remote_update_flags : c_int
{
/* Write the fetch results to FETCH_HEAD. */
GIT_REMOTE_UPDATE_FETCHHEAD = (1 << 0),
/* Report unchanged tips in the update_tips callback. */
GIT_REMOTE_UPDATE_REPORT_UNCHANGED = (1 << 1)
}
/**
* Remote redirection settings; whether redirects to another host
* are permitted. By default, git will follow a redirect on the
* initial request (`/info/refs`), but not subsequent requests.
*/
public enum git_remote_redirect_t : c_int
{
/**
* Do not follow any off-site redirects at any stage of
* the fetch or push.
*/
GIT_REMOTE_REDIRECT_NONE = (1 << 0),
/**
* Allow off-site redirects only upon the initial request.
* This is the default.
*/
GIT_REMOTE_REDIRECT_INITIAL = (1 << 1),
/**
* Allow redirects at any stage in the fetch or push.
*/
GIT_REMOTE_REDIRECT_ALL = (1 << 2)
}
/** /**
* Fetch options structure. * Fetch options structure.
* *
@ -3078,25 +3287,26 @@ namespace Git
* *
* git_fetch_options opts = GIT_FETCH_OPTIONS_INIT; * git_fetch_options opts = GIT_FETCH_OPTIONS_INIT;
*/ */
[CRepr]
public struct git_fetch_options public struct git_fetch_options
{ {
c_int version; public c_int version;
/** /**
* Callbacks to use for this fetch operation * Callbacks to use for this fetch operation
*/ */
git_remote_callbacks callbacks; public git_remote_callbacks callbacks;
/** /**
* Whether to perform a prune after the fetch * Whether to perform a prune after the fetch
*/ */
git_fetch_prune_t prune; public git_fetch_prune_t prune;
/** /**
* Whether to write the results to FETCH_HEAD. Defaults to * Whether to write the results to FETCH_HEAD. Defaults to
* on. Leave this default in order to behave like git. * on. Leave this default in order to behave like git.
*/ */
int update_fetchhead; public git_remote_update_flags update_fetchhead;
/** /**
* Determines how to behave regarding tags on the remote, such * Determines how to behave regarding tags on the remote, such
@ -3105,21 +3315,45 @@ namespace Git
* *
* The default is to auto-follow tags. * The default is to auto-follow tags.
*/ */
git_remote_autotag_option_t download_tags; public git_remote_autotag_option_t download_tags;
/** /**
* Proxy options to use, by default no proxy is used. * Proxy options to use, by default no proxy is used.
*/ */
git_proxy_options proxy_opts; public git_proxy_options proxy_opts;
/**
* Depth of the fetch to perform, or `GIT_FETCH_DEPTH_FULL`
* (or `0`) for full history, or `GIT_FETCH_DEPTH_UNSHALLOW`
* to "unshallow" a shallow repository.
*
* The default is full (`GIT_FETCH_DEPTH_FULL` or `0`).
*/
public c_int depth;
/**
* Whether to allow off-site redirects. If this is not
* specified, the `http.followRedirects` configuration setting
* will be consulted.
*/
public git_remote_redirect_t follow_redirects;
/** /**
* Extra headers for this fetch operation * Extra headers for this fetch operation
*/ */
git_strarray custom_headers; public git_strarray custom_headers;
} }
//#define GIT_FETCH_OPTIONS_VERSION 1 const int GIT_FETCH_OPTIONS_VERSION = 1;
//#define GIT_FETCH_OPTIONS_INIT { GIT_FETCH_OPTIONS_VERSION, GIT_REMOTE_CALLBACKS_INIT, GIT_FETCH_PRUNE_UNSPECIFIED, 1, \ public static git_fetch_options GIT_FETCH_OPTIONS_INIT = .()
{
version = GIT_FETCH_OPTIONS_VERSION,
callbacks = GIT_REMOTE_CALLBACKS_INIT,
prune = .GIT_FETCH_PRUNE_UNSPECIFIED,
update_fetchhead = .GIT_REMOTE_UPDATE_FETCHHEAD,
download_tags = .GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED,
proxy_opts = GIT_PROXY_OPTIONS_INIT
};
// GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, GIT_PROXY_OPTIONS_INIT } // GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, GIT_PROXY_OPTIONS_INIT }
/** /**
@ -3140,9 +3374,10 @@ namespace Git
/** /**
* Controls the behavior of a git_push object. * Controls the behavior of a git_push object.
*/ */
[CRepr]
public struct git_push_options public struct git_push_options
{ {
c_uint version; public c_uint version;
/** /**
* If the transport being used to push to the remote requires the creation * If the transport being used to push to the remote requires the creation
@ -3152,26 +3387,32 @@ namespace Git
* If set to 0, the packbuilder will auto-detect the number of threads * If set to 0, the packbuilder will auto-detect the number of threads
* to create. The default value is 1. * to create. The default value is 1.
*/ */
c_uint pb_parallelism; public c_uint pb_parallelism;
/** /**
* Callbacks to use for this push operation * Callbacks to use for this push operation
*/ */
git_remote_callbacks callbacks; public git_remote_callbacks callbacks;
/** /**
* Proxy options to use, by default no proxy is used. * Proxy options to use, by default no proxy is used.
*/ */
git_proxy_options proxy_opts; public git_proxy_options proxy_opts;
/** /**
* Extra headers for this push operation * Extra headers for this push operation
*/ */
git_strarray custom_headers; public git_strarray custom_headers;
} }
//#define GIT_PUSH_OPTIONS_VERSION 1 const int GIT_PUSH_OPTIONS_VERSION = 1;
//#define GIT_PUSH_OPTIONS_INIT { GIT_PUSH_OPTIONS_VERSION, 1, GIT_REMOTE_CALLBACKS_INIT, GIT_PROXY_OPTIONS_INIT } public static git_push_options GIT_PUSH_OPTIONS_INIT = .()
{
version = GIT_PUSH_OPTIONS_VERSION,
pb_parallelism = 1,
callbacks = .GIT_REMOTE_CALLBACKS_INIT,
proxy_opts = GIT_PROXY_OPTIONS_INIT
};
/** /**
* Initialize git_push_options structure * Initialize git_push_options structure
@ -3397,7 +3638,7 @@ namespace Git
* You give checkout one of three strategies for update: * You give checkout one of three strategies for update:
* *
* - `GIT_CHECKOUT_NONE` is a dry-run strategy that checks for conflicts, * - `GIT_CHECKOUT_NONE` is a dry-run strategy that checks for conflicts,
* etc., but doesn't make any actual changes. * etc., but doesn't make any actual changes.fGIT_CHECKOUT_SAFE
* *
* - `GIT_CHECKOUT_FORCE` is at the opposite extreme, taking any action to * - `GIT_CHECKOUT_FORCE` is at the opposite extreme, taking any action to
* make the working directory match the target (including potentially * make the working directory match the target (including potentially
@ -3607,6 +3848,15 @@ namespace Git
git_diff_file *workdir, git_diff_file *workdir,
void *payload); void *payload);
[CRepr]
public struct progress_data
{
public git_indexer_progress fetch_progress;
public c_size completed_steps;
public c_size total_steps;
public char8 *path;
}
/** Checkout progress notification function */ /** Checkout progress notification function */
public function void git_checkout_progress_cb( public function void git_checkout_progress_cb(
char8 *path, char8 *path,
@ -3626,11 +3876,12 @@ namespace Git
* use `git_checkout_options_init`. * use `git_checkout_options_init`.
* *
*/ */
[CRepr]
public struct git_checkout_options public struct git_checkout_options
{ {
public c_uint version; /**< The version */ public c_uint version; /**< The version */
public c_uint checkout_strategy; /**< default will be a safe checkout */ public git_checkout_strategy_t checkout_strategy; /**< default will be a safe checkout */
public c_int disable_filters; /**< don't apply filters like CRLF conversion */ public c_int disable_filters; /**< don't apply filters like CRLF conversion */
public c_uint dir_mode; /**< default is 0755 */ public c_uint dir_mode; /**< default is 0755 */
@ -3692,7 +3943,7 @@ namespace Git
public void *perfdata_payload; public void *perfdata_payload;
} }
//#define GIT_CHECKOUT_OPTIONS_VERSION 1 const int GIT_CHECKOUT_OPTIONS_VERSION = 1;
//#define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE} //#define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}
/** /**
@ -3842,7 +4093,8 @@ namespace Git
* use `git_clone_options_init`. * use `git_clone_options_init`.
* *
*/ */
struct git_clone_options [CRepr]
public struct git_clone_options
{ {
public c_uint version; public c_uint version;
@ -3906,8 +4158,13 @@ namespace Git
public void *remote_cb_payload; public void *remote_cb_payload;
} }
//#define GIT_CLONE_OPTIONS_VERSION 1 const int GIT_CLONE_OPTIONS_VERSION = 1;
//#define GIT_CLONE_OPTIONS_INIT { GIT_CLONE_OPTIONS_VERSION, \ public static git_clone_options GIT_CLONE_OPTIONS_INIT = .()
{
version = GIT_CLONE_OPTIONS_VERSION,
checkout_opts = .() { version = GIT_CHECKOUT_OPTIONS_VERSION, checkout_strategy = .GIT_CHECKOUT_SAFE },
fetch_opts = GIT_FETCH_OPTIONS_INIT
};
//{ GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE }, \ //{ GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE }, \
//GIT_FETCH_OPTIONS_INIT } //GIT_FETCH_OPTIONS_INIT }
@ -3941,7 +4198,7 @@ namespace Git
* `git_error_last` for a detailed error message) * `git_error_last` for a detailed error message)
*/ */
[CLink, CallingConvention(.Stdcall)] [CLink, CallingConvention(.Stdcall)]
public static extern int git_clone(out git_repository *outVal, char8* url, char8* local_path, git_clone_options *options); public static extern git_error_code git_clone(out git_repository *outVal, char8* url, char8* local_path, git_clone_options *options);
} }