mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
chore: upgrade to libgit2-1.2.0
This commit is contained in:
parent
b83fea9360
commit
a1e420d86c
36 changed files with 2889 additions and 1024 deletions
|
@ -130,9 +130,32 @@ GIT_EXTERN(git_attr_value_t) git_attr_value(const char *attr);
|
|||
*
|
||||
* Passing the `GIT_ATTR_CHECK_INCLUDE_HEAD` flag will use attributes
|
||||
* from a `.gitattributes` file in the repository at the HEAD revision.
|
||||
*
|
||||
* Passing the `GIT_ATTR_CHECK_INCLUDE_COMMIT` flag will use attributes
|
||||
* from a `.gitattributes` file in a specific commit.
|
||||
*/
|
||||
#define GIT_ATTR_CHECK_NO_SYSTEM (1 << 2)
|
||||
#define GIT_ATTR_CHECK_INCLUDE_HEAD (1 << 3)
|
||||
#define GIT_ATTR_CHECK_INCLUDE_COMMIT (1 << 4)
|
||||
|
||||
/**
|
||||
* An options structure for querying attributes.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version;
|
||||
|
||||
/** A combination of GIT_ATTR_CHECK flags */
|
||||
unsigned int flags;
|
||||
|
||||
/**
|
||||
* The commit to load attributes from, when
|
||||
* `GIT_ATTR_CHECK_INCLUDE_COMMIT` is specified.
|
||||
*/
|
||||
git_oid *commit_id;
|
||||
} git_attr_options;
|
||||
|
||||
#define GIT_ATTR_OPTIONS_VERSION 1
|
||||
#define GIT_ATTR_OPTIONS_INIT {GIT_ATTR_OPTIONS_VERSION}
|
||||
|
||||
/**
|
||||
* Look up the value of one git attribute for path.
|
||||
|
@ -156,6 +179,28 @@ GIT_EXTERN(int) git_attr_get(
|
|||
const char *path,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Look up the value of one git attribute for path with extended options.
|
||||
*
|
||||
* @param value_out Output of the value of the attribute. Use the GIT_ATTR_...
|
||||
* macros to test for TRUE, FALSE, UNSPECIFIED, etc. or just
|
||||
* use the string value for attributes set to a value. You
|
||||
* should NOT modify or free this value.
|
||||
* @param repo The repository containing the path.
|
||||
* @param opts The `git_attr_options` to use when querying these attributes.
|
||||
* @param path The path to check for attributes. Relative paths are
|
||||
* interpreted relative to the repo root. The file does
|
||||
* not have to exist, but if it does not, then it will be
|
||||
* treated as a plain file (not a directory).
|
||||
* @param name The name of the attribute to look up.
|
||||
*/
|
||||
GIT_EXTERN(int) git_attr_get_ext(
|
||||
const char **value_out,
|
||||
git_repository *repo,
|
||||
git_attr_options *opts,
|
||||
const char *path,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Look up a list of git attributes for path.
|
||||
*
|
||||
|
@ -193,6 +238,30 @@ GIT_EXTERN(int) git_attr_get_many(
|
|||
size_t num_attr,
|
||||
const char **names);
|
||||
|
||||
/**
|
||||
* Look up a list of git attributes for path with extended options.
|
||||
*
|
||||
* @param values_out An array of num_attr entries that will have string
|
||||
* pointers written into it for the values of the attributes.
|
||||
* You should not modify or free the values that are written
|
||||
* into this array (although of course, you should free the
|
||||
* array itself if you allocated it).
|
||||
* @param repo The repository containing the path.
|
||||
* @param opts The `git_attr_options` to use when querying these attributes.
|
||||
* @param path The path inside the repo to check attributes. This
|
||||
* does not have to exist, but if it does not, then
|
||||
* it will be treated as a plain file (i.e. not a directory).
|
||||
* @param num_attr The number of attributes being looked up
|
||||
* @param names An array of num_attr strings containing attribute names.
|
||||
*/
|
||||
GIT_EXTERN(int) git_attr_get_many_ext(
|
||||
const char **values_out,
|
||||
git_repository *repo,
|
||||
git_attr_options *opts,
|
||||
const char *path,
|
||||
size_t num_attr,
|
||||
const char **names);
|
||||
|
||||
/**
|
||||
* The callback used with git_attr_foreach.
|
||||
*
|
||||
|
@ -231,6 +300,26 @@ GIT_EXTERN(int) git_attr_foreach(
|
|||
git_attr_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Loop over all the git attributes for a path with extended options.
|
||||
*
|
||||
* @param repo The repository containing the path.
|
||||
* @param opts The `git_attr_options` to use when querying these attributes.
|
||||
* @param path Path inside the repo to check attributes. This does not have
|
||||
* to exist, but if it does not, then it will be treated as a
|
||||
* plain file (i.e. not a directory).
|
||||
* @param callback Function to invoke on each attribute name and value.
|
||||
* See git_attr_foreach_cb.
|
||||
* @param payload Passed on as extra parameter to callback function.
|
||||
* @return 0 on success, non-zero callback return value, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_attr_foreach_ext(
|
||||
git_repository *repo,
|
||||
git_attr_options *opts,
|
||||
const char *path,
|
||||
git_attr_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Flush the gitattributes cache.
|
||||
*
|
||||
|
|
|
@ -26,27 +26,52 @@ GIT_BEGIN_DECL
|
|||
typedef enum {
|
||||
/** Normal blame, the default */
|
||||
GIT_BLAME_NORMAL = 0,
|
||||
/** Track lines that have moved within a file (like `git blame -M`).
|
||||
* NOT IMPLEMENTED. */
|
||||
|
||||
/**
|
||||
* Track lines that have moved within a file (like `git blame -M`).
|
||||
*
|
||||
* This is not yet implemented and reserved for future use.
|
||||
*/
|
||||
GIT_BLAME_TRACK_COPIES_SAME_FILE = (1<<0),
|
||||
/** Track lines that have moved across files in the same commit (like `git blame -C`).
|
||||
* NOT IMPLEMENTED. */
|
||||
|
||||
/**
|
||||
* Track lines that have moved across files in the same commit
|
||||
* (like `git blame -C`).
|
||||
*
|
||||
* This is not yet implemented and reserved for future use.
|
||||
*/
|
||||
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES = (1<<1),
|
||||
/** Track lines that have been copied from another file that exists in the
|
||||
* same commit (like `git blame -CC`). Implies SAME_FILE.
|
||||
* NOT IMPLEMENTED. */
|
||||
|
||||
/**
|
||||
* Track lines that have been copied from another file that exists
|
||||
* in the same commit (like `git blame -CC`). Implies SAME_FILE.
|
||||
*
|
||||
* This is not yet implemented and reserved for future use.
|
||||
*/
|
||||
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = (1<<2),
|
||||
/** Track lines that have been copied from another file that exists in *any*
|
||||
* commit (like `git blame -CCC`). Implies SAME_COMMIT_COPIES.
|
||||
* NOT IMPLEMENTED. */
|
||||
|
||||
/**
|
||||
* Track lines that have been copied from another file that exists in
|
||||
* *any* commit (like `git blame -CCC`). Implies SAME_COMMIT_COPIES.
|
||||
*
|
||||
* This is not yet implemented and reserved for future use.
|
||||
*/
|
||||
GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = (1<<3),
|
||||
/** Restrict the search of commits to those reachable following only the
|
||||
* first parents. */
|
||||
|
||||
/**
|
||||
* Restrict the search of commits to those reachable following only
|
||||
* the first parents.
|
||||
*/
|
||||
GIT_BLAME_FIRST_PARENT = (1<<4),
|
||||
/** Use mailmap file to map author and committer names and email addresses
|
||||
* to canonical real names and email addresses. The mailmap will be read
|
||||
* from the working directory, or HEAD in a bare repository. */
|
||||
|
||||
/**
|
||||
* Use mailmap file to map author and committer names and email
|
||||
* addresses to canonical real names and email addresses. The
|
||||
* mailmap will be read from the working directory, or HEAD in a
|
||||
* bare repository.
|
||||
*/
|
||||
GIT_BLAME_USE_MAILMAP = (1<<5),
|
||||
|
||||
/** Ignore whitespace differences */
|
||||
GIT_BLAME_IGNORE_WHITESPACE = (1<<6),
|
||||
} git_blame_flag_t;
|
||||
|
@ -63,25 +88,33 @@ typedef struct git_blame_options {
|
|||
|
||||
/** A combination of `git_blame_flag_t` */
|
||||
uint32_t flags;
|
||||
/** The lower bound on the number of alphanumeric
|
||||
* characters that must be detected as moving/copying within a file for it to
|
||||
* associate those lines with the parent commit. The default value is 20.
|
||||
* This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
|
||||
* flags are specified.
|
||||
|
||||
/**
|
||||
* The lower bound on the number of alphanumeric characters that
|
||||
* must be detected as moving/copying within a file for it to
|
||||
* associate those lines with the parent commit. The default value
|
||||
* is 20.
|
||||
*
|
||||
* This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
|
||||
* flags are specified.
|
||||
*/
|
||||
uint16_t min_match_characters;
|
||||
|
||||
/** The id of the newest commit to consider. The default is HEAD. */
|
||||
git_oid newest_commit;
|
||||
|
||||
/**
|
||||
* The id of the oldest commit to consider.
|
||||
* The default is the first commit encountered with a NULL parent.
|
||||
*/
|
||||
git_oid oldest_commit;
|
||||
|
||||
/**
|
||||
* The first line in the file to blame.
|
||||
* The default is 1 (line numbers start with 1).
|
||||
*/
|
||||
size_t min_line;
|
||||
|
||||
/**
|
||||
* The last line in the file to blame.
|
||||
* The default is the last line of the file.
|
||||
|
@ -108,41 +141,59 @@ GIT_EXTERN(int) git_blame_options_init(
|
|||
|
||||
/**
|
||||
* Structure that represents a blame hunk.
|
||||
*
|
||||
* - `lines_in_hunk` is the number of lines in this hunk
|
||||
* - `final_commit_id` is the OID of the commit where this line was last
|
||||
* changed.
|
||||
* - `final_start_line_number` is the 1-based line number where this hunk
|
||||
* begins, in the final version of the file
|
||||
* - `final_signature` is the author of `final_commit_id`. If
|
||||
* `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
|
||||
* real name and email address.
|
||||
* - `orig_commit_id` is the OID of the commit where this hunk was found. This
|
||||
* will usually be the same as `final_commit_id`, except when
|
||||
* `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
|
||||
* - `orig_path` is the path to the file where this hunk originated, as of the
|
||||
* commit specified by `orig_commit_id`.
|
||||
* - `orig_start_line_number` is the 1-based line number where this hunk begins
|
||||
* in the file named by `orig_path` in the commit specified by
|
||||
* `orig_commit_id`.
|
||||
* - `orig_signature` is the author of `orig_commit_id`. If
|
||||
* `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
|
||||
* real name and email address.
|
||||
* - `boundary` is 1 iff the hunk has been tracked to a boundary commit (the
|
||||
* root, or the commit specified in git_blame_options.oldest_commit)
|
||||
*/
|
||||
typedef struct git_blame_hunk {
|
||||
/**
|
||||
* The number of lines in this hunk.
|
||||
*/
|
||||
size_t lines_in_hunk;
|
||||
|
||||
/**
|
||||
* The OID of the commit where this line was last changed.
|
||||
*/
|
||||
git_oid final_commit_id;
|
||||
|
||||
/**
|
||||
* The 1-based line number where this hunk begins, in the final version
|
||||
* of the file.
|
||||
*/
|
||||
size_t final_start_line_number;
|
||||
|
||||
/**
|
||||
* The author of `final_commit_id`. If `GIT_BLAME_USE_MAILMAP` has been
|
||||
* specified, it will contain the canonical real name and email address.
|
||||
*/
|
||||
git_signature *final_signature;
|
||||
|
||||
/**
|
||||
* The OID of the commit where this hunk was found.
|
||||
* This will usually be the same as `final_commit_id`, except when
|
||||
* `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
|
||||
*/
|
||||
git_oid orig_commit_id;
|
||||
|
||||
/**
|
||||
* The path to the file where this hunk originated, as of the commit
|
||||
* specified by `orig_commit_id`.
|
||||
*/
|
||||
const char *orig_path;
|
||||
|
||||
/**
|
||||
* The 1-based line number where this hunk begins in the file named by
|
||||
* `orig_path` in the commit specified by `orig_commit_id`.
|
||||
*/
|
||||
size_t orig_start_line_number;
|
||||
|
||||
/**
|
||||
* The author of `orig_commit_id`. If `GIT_BLAME_USE_MAILMAP` has been
|
||||
* specified, it will contain the canonical real name and email address.
|
||||
*/
|
||||
git_signature *orig_signature;
|
||||
|
||||
/**
|
||||
* The 1 iff the hunk has been tracked to a boundary commit (the root,
|
||||
* or the commit specified in git_blame_options.oldest_commit)
|
||||
*/
|
||||
char boundary;
|
||||
} git_blame_hunk;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ GIT_EXTERN(git_repository *) git_blob_owner(const git_blob *blob);
|
|||
* time.
|
||||
*
|
||||
* @param blob pointer to the blob
|
||||
* @return the pointer
|
||||
* @return the pointer, or NULL on error
|
||||
*/
|
||||
GIT_EXTERN(const void *) git_blob_rawcontent(const git_blob *blob);
|
||||
|
||||
|
@ -113,7 +113,13 @@ typedef enum {
|
|||
* When set, filters will be loaded from a `.gitattributes` file
|
||||
* in the HEAD commit.
|
||||
*/
|
||||
GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD = (1 << 2),
|
||||
GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD = (1 << 2),
|
||||
|
||||
/**
|
||||
* When set, filters will be loaded from a `.gitattributes` file
|
||||
* in the specified commit.
|
||||
*/
|
||||
GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT = (1 << 3),
|
||||
} git_blob_filter_flag_t;
|
||||
|
||||
/**
|
||||
|
@ -128,6 +134,12 @@ typedef struct {
|
|||
|
||||
/** Flags to control the filtering process, see `git_blob_filter_flag_t` above */
|
||||
uint32_t flags;
|
||||
|
||||
/**
|
||||
* The commit to load attributes from, when
|
||||
* `GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT` is specified.
|
||||
*/
|
||||
git_oid *commit_id;
|
||||
} git_blob_filter_options;
|
||||
|
||||
#define GIT_BLOB_FILTER_OPTIONS_VERSION 1
|
||||
|
|
|
@ -304,6 +304,31 @@ GIT_EXTERN(int) git_branch_remote_name(
|
|||
*/
|
||||
GIT_EXTERN(int) git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *refname);
|
||||
|
||||
/**
|
||||
* Retrieve the upstream merge of a local branch
|
||||
*
|
||||
* This will return the currently configured "branch.*.merge" for a given
|
||||
* branch. This branch must be local.
|
||||
*
|
||||
* @param buf the buffer into which to write the name
|
||||
* @param repo the repository in which to look
|
||||
* @param refname the full name of the branch
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_upstream_merge(git_buf *buf, git_repository *repo, const char *refname);
|
||||
|
||||
/**
|
||||
* Determine whether a branch name is valid, meaning that (when prefixed
|
||||
* with `refs/heads/`) that it is a valid reference name, and that any
|
||||
* additional branch name restrictions are imposed (eg, it cannot start
|
||||
* with a `-`).
|
||||
*
|
||||
* @param valid output pointer to set with validity of given branch name
|
||||
* @param name a branch name to test
|
||||
* @return 0 on success or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_name_is_valid(int *valid, const char *name);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define INCLUDE_git_cert_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/cert.h
|
||||
|
@ -80,8 +81,27 @@ typedef enum {
|
|||
GIT_CERT_SSH_SHA1 = (1 << 1),
|
||||
/** SHA-256 is available */
|
||||
GIT_CERT_SSH_SHA256 = (1 << 2),
|
||||
/** Raw hostkey is available */
|
||||
GIT_CERT_SSH_RAW = (1 << 3),
|
||||
} git_cert_ssh_t;
|
||||
|
||||
typedef enum {
|
||||
/** The raw key is of an unknown type. */
|
||||
GIT_CERT_SSH_RAW_TYPE_UNKNOWN = 0,
|
||||
/** The raw key is an RSA key. */
|
||||
GIT_CERT_SSH_RAW_TYPE_RSA = 1,
|
||||
/** The raw key is a DSS key. */
|
||||
GIT_CERT_SSH_RAW_TYPE_DSS = 2,
|
||||
/** The raw key is a ECDSA 256 key. */
|
||||
GIT_CERT_SSH_RAW_TYPE_KEY_ECDSA_256 = 3,
|
||||
/** The raw key is a ECDSA 384 key. */
|
||||
GIT_CERT_SSH_RAW_TYPE_KEY_ECDSA_384 = 4,
|
||||
/** The raw key is a ECDSA 521 key. */
|
||||
GIT_CERT_SSH_RAW_TYPE_KEY_ECDSA_521 = 5,
|
||||
/** The raw key is a ED25519 key. */
|
||||
GIT_CERT_SSH_RAW_TYPE_KEY_ED25519 = 6
|
||||
} git_cert_ssh_raw_type_t;
|
||||
|
||||
/**
|
||||
* Hostkey information taken from libssh2
|
||||
*/
|
||||
|
@ -89,28 +109,45 @@ typedef struct {
|
|||
git_cert parent; /**< The parent cert */
|
||||
|
||||
/**
|
||||
* A hostkey type from libssh2, either
|
||||
* `GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1`
|
||||
* A bitmask containing the available fields.
|
||||
*/
|
||||
git_cert_ssh_t type;
|
||||
|
||||
/**
|
||||
* Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will
|
||||
* Hostkey hash. If `type` has `GIT_CERT_SSH_MD5` set, this will
|
||||
* have the MD5 hash of the hostkey.
|
||||
*/
|
||||
unsigned char hash_md5[16];
|
||||
|
||||
/**
|
||||
* Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will
|
||||
* Hostkey hash. If `type` has `GIT_CERT_SSH_SHA1` set, this will
|
||||
* have the SHA-1 hash of the hostkey.
|
||||
*/
|
||||
unsigned char hash_sha1[20];
|
||||
|
||||
/**
|
||||
* Hostkey hash. If type has `GIT_CERT_SSH_SHA256` set, this will
|
||||
* Hostkey hash. If `type` has `GIT_CERT_SSH_SHA256` set, this will
|
||||
* have the SHA-256 hash of the hostkey.
|
||||
*/
|
||||
unsigned char hash_sha256[32];
|
||||
|
||||
/**
|
||||
* Raw hostkey type. If `type` has `GIT_CERT_SSH_RAW` set, this will
|
||||
* have the type of the raw hostkey.
|
||||
*/
|
||||
git_cert_ssh_raw_type_t raw_type;
|
||||
|
||||
/**
|
||||
* Pointer to the raw hostkey. If `type` has `GIT_CERT_SSH_RAW` set,
|
||||
* this will have the raw contents of the hostkey.
|
||||
*/
|
||||
const char *hostkey;
|
||||
|
||||
/**
|
||||
* Raw hostkey length. If `type` has `GIT_CERT_SSH_RAW` set, this will
|
||||
* have the length of the raw contents of the hostkey.
|
||||
*/
|
||||
size_t hostkey_len;
|
||||
} git_cert_hostkey;
|
||||
|
||||
/**
|
||||
|
|
|
@ -177,6 +177,12 @@ typedef enum {
|
|||
/** Normally checkout writes the index upon completion; this prevents that. */
|
||||
GIT_CHECKOUT_DONT_WRITE_INDEX = (1u << 23),
|
||||
|
||||
/**
|
||||
* Show what would be done by a checkout. Stop after sending
|
||||
* notifications; don't update the working directory or index.
|
||||
*/
|
||||
GIT_CHECKOUT_DRY_RUN = (1u << 24),
|
||||
|
||||
/**
|
||||
* THE FOLLOWING OPTIONS ARE NOT YET IMPLEMENTED
|
||||
*/
|
||||
|
@ -194,18 +200,6 @@ typedef enum {
|
|||
* Checkout will invoke an options notification callback (`notify_cb`) for
|
||||
* certain cases - you pick which ones via `notify_flags`:
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_CONFLICT invokes checkout on conflicting paths.
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_DIRTY notifies about "dirty" files, i.e. those that
|
||||
* do not need an update but no longer match the baseline. Core git
|
||||
* displays these files when checkout runs, but won't stop the checkout.
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_UPDATED sends notification for any file changed.
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_UNTRACKED notifies about untracked files.
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_IGNORED notifies about ignored files.
|
||||
*
|
||||
* Returning a non-zero value from this callback will cancel the checkout.
|
||||
* The non-zero return value will be propagated back and returned by the
|
||||
* git_checkout_... call.
|
||||
|
@ -216,10 +210,32 @@ typedef enum {
|
|||
*/
|
||||
typedef enum {
|
||||
GIT_CHECKOUT_NOTIFY_NONE = 0,
|
||||
|
||||
/**
|
||||
* Invokes checkout on conflicting paths.
|
||||
*/
|
||||
GIT_CHECKOUT_NOTIFY_CONFLICT = (1u << 0),
|
||||
|
||||
/**
|
||||
* Notifies about "dirty" files, i.e. those that do not need an update
|
||||
* but no longer match the baseline. Core git displays these files when
|
||||
* checkout runs, but won't stop the checkout.
|
||||
*/
|
||||
GIT_CHECKOUT_NOTIFY_DIRTY = (1u << 1),
|
||||
|
||||
/**
|
||||
* Sends notification for any file changed.
|
||||
*/
|
||||
GIT_CHECKOUT_NOTIFY_UPDATED = (1u << 2),
|
||||
|
||||
/**
|
||||
* Notifies about untracked files.
|
||||
*/
|
||||
GIT_CHECKOUT_NOTIFY_UNTRACKED = (1u << 3),
|
||||
|
||||
/**
|
||||
* Notifies about ignored files.
|
||||
*/
|
||||
GIT_CHECKOUT_NOTIFY_IGNORED = (1u << 4),
|
||||
|
||||
GIT_CHECKOUT_NOTIFY_ALL = 0x0FFFFu
|
||||
|
|
|
@ -503,25 +503,41 @@ GIT_EXTERN(int) git_commit_create_with_signature(
|
|||
GIT_EXTERN(int) git_commit_dup(git_commit **out, git_commit *source);
|
||||
|
||||
/**
|
||||
* Commit signing callback.
|
||||
* Commit creation callback: used when a function is going to create
|
||||
* commits (for example, in `git_rebase_commit`) to allow callers to
|
||||
* override the commit creation behavior. For example, users may
|
||||
* wish to sign commits by providing this information to
|
||||
* `git_commit_create_buffer`, signing that buffer, then calling
|
||||
* `git_commit_create_with_signature`. The resultant commit id
|
||||
* should be set in the `out` object id parameter.
|
||||
*
|
||||
* The callback will be called with the commit content, giving a user an
|
||||
* opportunity to sign the commit content. The signature_field
|
||||
* buf may be left empty to specify the default field "gpgsig".
|
||||
*
|
||||
* Signatures can take the form of any string, and can be created on an arbitrary
|
||||
* header field. Signatures are most commonly used for verifying authorship of a
|
||||
* commit using GPG or a similar cryptographically secure signing algorithm.
|
||||
* See https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work for more
|
||||
* details.
|
||||
*
|
||||
* When the callback:
|
||||
* - returns GIT_PASSTHROUGH, no signature will be added to the commit.
|
||||
* - returns < 0, commit creation will be aborted.
|
||||
* - returns GIT_OK, the signature parameter is expected to be filled.
|
||||
* @param out pointer that this callback will populate with the object
|
||||
* id of the commit that is created
|
||||
* @param author the author name and time of the commit
|
||||
* @param committer the committer name and time of the commit
|
||||
* @param message_encoding the encoding of the given message, or NULL
|
||||
* to assume UTF8
|
||||
* @param message the commit message
|
||||
* @param tree the tree to be committed
|
||||
* @param parent_count the number of parents for this commit
|
||||
* @param parents the commit parents
|
||||
* @param payload the payload pointer in the rebase options
|
||||
* @return 0 if this callback has created the commit and populated the out
|
||||
* parameter, GIT_PASSTHROUGH if the callback has not created a
|
||||
* commit and wants the calling function to create the commit as
|
||||
* if no callback had been specified, any other value to stop
|
||||
* and return a failure
|
||||
*/
|
||||
typedef int (*git_commit_signing_cb)(
|
||||
git_buf *signature, git_buf *signature_field, const char *commit_content, void *payload);
|
||||
typedef int (*git_commit_create_cb)(
|
||||
git_oid *out,
|
||||
const git_signature *author,
|
||||
const git_signature *committer,
|
||||
const char *message_encoding,
|
||||
const char *message,
|
||||
const git_tree *tree,
|
||||
size_t parent_count,
|
||||
const git_commit *parents[],
|
||||
void *payload);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
|
|
|
@ -91,10 +91,10 @@ GIT_BEGIN_DECL
|
|||
|
||||
/**
|
||||
* The separator used in path list strings (ie like in the PATH
|
||||
* environment variable). A semi-colon ";" is used on Windows, and
|
||||
* a colon ":" for all other systems.
|
||||
* environment variable). A semi-colon ";" is used on Windows and
|
||||
* AmigaOS, and a colon ":" for all other systems.
|
||||
*/
|
||||
#ifdef GIT_WIN32
|
||||
#if defined(GIT_WIN32) || defined(AMIGA)
|
||||
#define GIT_PATH_LIST_SEPARATOR ';'
|
||||
#else
|
||||
#define GIT_PATH_LIST_SEPARATOR ':'
|
||||
|
@ -207,7 +207,9 @@ typedef enum {
|
|||
GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS,
|
||||
GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE,
|
||||
GIT_OPT_GET_MWINDOW_FILE_LIMIT,
|
||||
GIT_OPT_SET_MWINDOW_FILE_LIMIT
|
||||
GIT_OPT_SET_MWINDOW_FILE_LIMIT,
|
||||
GIT_OPT_SET_ODB_PACKED_PRIORITY,
|
||||
GIT_OPT_SET_ODB_LOOSE_PRIORITY
|
||||
} git_libgit2_opt_t;
|
||||
|
||||
/**
|
||||
|
@ -421,6 +423,14 @@ typedef enum {
|
|||
* > authentication, use expect/continue when POSTing data.
|
||||
* > This option is not available on Windows.
|
||||
*
|
||||
* opts(GIT_OPT_SET_ODB_PACKED_PRIORITY, int priority)
|
||||
* > Override the default priority of the packed ODB backend which
|
||||
* > is added when default backends are assigned to a repository
|
||||
*
|
||||
* opts(GIT_OPT_SET_ODB_LOOSE_PRIORITY, int priority)
|
||||
* > Override the default priority of the loose ODB backend which
|
||||
* > is added when default backends are assigned to a repository
|
||||
*
|
||||
* @param option Option key
|
||||
* @param ... value to set the option
|
||||
* @return 0 on success, <0 on failure
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "describe.h"
|
||||
#include "diff.h"
|
||||
#include "errors.h"
|
||||
#include "filter.h"
|
||||
#include "index.h"
|
||||
#include "indexer.h"
|
||||
#include "merge.h"
|
||||
|
@ -29,6 +30,7 @@
|
|||
#include "trace.h"
|
||||
#include "repository.h"
|
||||
#include "revert.h"
|
||||
#include "revparse.h"
|
||||
#include "stash.h"
|
||||
#include "status.h"
|
||||
#include "submodule.h"
|
||||
|
@ -80,16 +82,19 @@ typedef git_attr_value_t git_attr_t;
|
|||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Blob Functions
|
||||
/** @name Deprecated Blob Functions and Constants
|
||||
*
|
||||
* These functions are retained for backward compatibility. The newer
|
||||
* versions of these functions should be preferred in all new code.
|
||||
* These functions and enumeration values are retained for backward
|
||||
* compatibility. The newer versions of these functions and values
|
||||
* should be preferred in all new code.
|
||||
*
|
||||
* There is no plan to remove these backward compatibility values at
|
||||
* this time.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
#define GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD
|
||||
|
||||
GIT_EXTERN(int) git_blob_create_fromworkdir(git_oid *id, git_repository *repo, const char *relative_path);
|
||||
GIT_EXTERN(int) git_blob_create_fromdisk(git_oid *id, git_repository *repo, const char *path);
|
||||
GIT_EXTERN(int) git_blob_create_fromstream(
|
||||
|
@ -115,6 +120,66 @@ GIT_EXTERN(int) git_blob_filtered_content(
|
|||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Filter Functions
|
||||
*
|
||||
* These functions are retained for backward compatibility. The
|
||||
* newer versions of these functions should be preferred in all
|
||||
* new code.
|
||||
*
|
||||
* There is no plan to remove these backward compatibility values at
|
||||
* this time.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/** Deprecated in favor of `git_filter_list_stream_buffer`.
|
||||
*
|
||||
* @deprecated Use git_filter_list_stream_buffer
|
||||
* @see Use git_filter_list_stream_buffer
|
||||
*/
|
||||
GIT_EXTERN(int) git_filter_list_stream_data(
|
||||
git_filter_list *filters,
|
||||
git_buf *data,
|
||||
git_writestream *target);
|
||||
|
||||
/** Deprecated in favor of `git_filter_list_apply_to_buffer`.
|
||||
*
|
||||
* @deprecated Use git_filter_list_apply_to_buffer
|
||||
* @see Use git_filter_list_apply_to_buffer
|
||||
*/
|
||||
GIT_EXTERN(int) git_filter_list_apply_to_data(
|
||||
git_buf *out,
|
||||
git_filter_list *filters,
|
||||
git_buf *in);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Tree Functions
|
||||
*
|
||||
* These functions are retained for backward compatibility. The
|
||||
* newer versions of these functions and values should be preferred
|
||||
* in all new code.
|
||||
*
|
||||
* There is no plan to remove these backward compatibility values at
|
||||
* this time.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Write the contents of the tree builder as a tree object.
|
||||
* This is an alias of `git_treebuilder_write` and is preserved
|
||||
* for backward compatibility.
|
||||
*
|
||||
* This function is deprecated, but there is no plan to remove this
|
||||
* function at this time.
|
||||
*
|
||||
* @deprecated Use git_treebuilder_write
|
||||
* @see git_treebuilder_write
|
||||
*/
|
||||
GIT_EXTERN(int) git_treebuilder_write_with_buffer(
|
||||
git_oid *oid, git_treebuilder *bld, git_buf *tree);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Buffer Functions
|
||||
*
|
||||
* These functions and enumeration values are retained for backward
|
||||
|
@ -126,6 +191,61 @@ GIT_EXTERN(int) git_blob_filtered_content(
|
|||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Static initializer for git_buf from static buffer
|
||||
*/
|
||||
#define GIT_BUF_INIT_CONST(STR,LEN) { (char *)(STR), 0, (size_t)(LEN) }
|
||||
|
||||
/**
|
||||
* Resize the buffer allocation to make more space.
|
||||
*
|
||||
* This will attempt to grow the buffer to accommodate the target size.
|
||||
*
|
||||
* If the buffer refers to memory that was not allocated by libgit2 (i.e.
|
||||
* the `asize` field is zero), then `ptr` will be replaced with a newly
|
||||
* allocated block of data. Be careful so that memory allocated by the
|
||||
* caller is not lost. As a special variant, if you pass `target_size` as
|
||||
* 0 and the memory is not allocated by libgit2, this will allocate a new
|
||||
* buffer of size `size` and copy the external data into it.
|
||||
*
|
||||
* Currently, this will never shrink a buffer, only expand it.
|
||||
*
|
||||
* If the allocation fails, this will return an error and the buffer will be
|
||||
* marked as invalid for future operations, invaliding the contents.
|
||||
*
|
||||
* @param buffer The buffer to be resized; may or may not be allocated yet
|
||||
* @param target_size The desired available size
|
||||
* @return 0 on success, -1 on allocation failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_buf_grow(git_buf *buffer, size_t target_size);
|
||||
|
||||
/**
|
||||
* Set buffer to a copy of some raw data.
|
||||
*
|
||||
* @param buffer The buffer to set
|
||||
* @param data The data to copy into the buffer
|
||||
* @param datalen The length of the data to copy into the buffer
|
||||
* @return 0 on success, -1 on allocation failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_buf_set(
|
||||
git_buf *buffer, const void *data, size_t datalen);
|
||||
|
||||
/**
|
||||
* Check quickly if buffer looks like it contains binary data
|
||||
*
|
||||
* @param buf Buffer to check
|
||||
* @return 1 if buffer looks like non-text data
|
||||
*/
|
||||
GIT_EXTERN(int) git_buf_is_binary(const git_buf *buf);
|
||||
|
||||
/**
|
||||
* Check quickly if buffer contains a NUL byte
|
||||
*
|
||||
* @param buf Buffer to check
|
||||
* @return 1 if buffer contains a NUL byte
|
||||
*/
|
||||
GIT_EXTERN(int) git_buf_contains_nul(const git_buf *buf);
|
||||
|
||||
/**
|
||||
* Free the memory referred to by the git_buf. This is an alias of
|
||||
* `git_buf_dispose` and is preserved for backward compatibility.
|
||||
|
@ -140,6 +260,27 @@ GIT_EXTERN(void) git_buf_free(git_buf *buffer);
|
|||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Commit Definitions
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Provide a commit signature during commit creation.
|
||||
*
|
||||
* Callers should instead define a `git_commit_create_cb` that
|
||||
* generates a commit buffer using `git_commit_create_buffer`, sign
|
||||
* that buffer and call `git_commit_create_with_signature`.
|
||||
*
|
||||
* @deprecated use a `git_commit_create_cb` instead
|
||||
*/
|
||||
typedef int (*git_commit_signing_cb)(
|
||||
git_buf *signature,
|
||||
git_buf *signature_field,
|
||||
const char *commit_content,
|
||||
void *payload);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Config Functions and Constants
|
||||
*/
|
||||
/**@{*/
|
||||
|
@ -340,10 +481,32 @@ GIT_EXTERN(size_t) git_object__size(git_object_t type);
|
|||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Reference Constants
|
||||
/** @name Deprecated Remote Functions
|
||||
*
|
||||
* These enumeration values are retained for backward compatibility. The
|
||||
* newer versions of these values should be preferred in all new code.
|
||||
* These functions are retained for backward compatibility. The newer
|
||||
* versions of these functions should be preferred in all new code.
|
||||
*
|
||||
* There is no plan to remove these backward compatibility functions at
|
||||
* this time.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Ensure the remote name is well-formed.
|
||||
*
|
||||
* @deprecated Use git_remote_name_is_valid
|
||||
* @param remote_name name to be checked.
|
||||
* @return 1 if the reference name is acceptable; 0 if it isn't
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_is_valid_name(const char *remote_name);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Reference Functions and Constants
|
||||
*
|
||||
* These functions and enumeration values are retained for backward
|
||||
* compatibility. The newer versions of these values should be
|
||||
* preferred in all new code.
|
||||
*
|
||||
* There is no plan to remove these backward compatibility values at
|
||||
* this time.
|
||||
|
@ -364,6 +527,23 @@ GIT_EXTERN(size_t) git_object__size(git_object_t type);
|
|||
#define GIT_REF_FORMAT_REFSPEC_PATTERN GIT_REFERENCE_FORMAT_REFSPEC_PATTERN
|
||||
#define GIT_REF_FORMAT_REFSPEC_SHORTHAND GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND
|
||||
|
||||
/**
|
||||
* Ensure the reference name is well-formed.
|
||||
*
|
||||
* Valid reference names must follow one of two patterns:
|
||||
*
|
||||
* 1. Top-level names must contain only capital letters and underscores,
|
||||
* and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
|
||||
* 2. Names prefixed with "refs/" can be almost anything. You must avoid
|
||||
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
|
||||
* sequences ".." and "@{" which have special meaning to revparse.
|
||||
*
|
||||
* @deprecated Use git_reference_name_is_valid
|
||||
* @param refname name to be checked.
|
||||
* @return 1 if the reference name is acceptable; 0 if it isn't
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_is_valid_name(const char *refname);
|
||||
|
||||
GIT_EXTERN(int) git_tag_create_frombuffer(
|
||||
git_oid *oid,
|
||||
git_repository *repo,
|
||||
|
@ -372,6 +552,25 @@ GIT_EXTERN(int) git_tag_create_frombuffer(
|
|||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Revspec Constants
|
||||
*
|
||||
* These enumeration values are retained for backward compatibility.
|
||||
* The newer versions of these values should be preferred in all new
|
||||
* code.
|
||||
*
|
||||
* There is no plan to remove these backward compatibility values at
|
||||
* this time.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
typedef git_revspec_t git_revparse_mode_t;
|
||||
|
||||
#define GIT_REVPARSE_SINGLE GIT_REVSPEC_SINGLE
|
||||
#define GIT_REVPARSE_RANGE GIT_REVSPEC_RANGE
|
||||
#define GIT_REVPARSE_MERGE_BASE GIT_REVSPEC_MERGE_BASE
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Deprecated Credential Types
|
||||
*
|
||||
* These types are retained for backward compatibility. The newer
|
||||
|
@ -380,6 +579,7 @@ GIT_EXTERN(int) git_tag_create_frombuffer(
|
|||
* There is no plan to remove these backward compatibility values at
|
||||
* this time.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
typedef git_credential git_cred;
|
||||
typedef git_credential_userpass_plaintext git_cred_userpass_plaintext;
|
||||
|
|
|
@ -168,6 +168,10 @@ typedef enum {
|
|||
* can apply given diff information to binary files.
|
||||
*/
|
||||
GIT_DIFF_SHOW_BINARY = (1u << 30),
|
||||
|
||||
/** Ignore blank lines */
|
||||
GIT_DIFF_IGNORE_BLANK_LINES = (1u << 31),
|
||||
|
||||
} git_diff_option_t;
|
||||
|
||||
/**
|
||||
|
@ -237,32 +241,43 @@ typedef enum {
|
|||
* Although this is called a "file", it could represent a file, a symbolic
|
||||
* link, a submodule commit id, or even a tree (although that only if you
|
||||
* are tracking type changes or ignored/untracked directories).
|
||||
*
|
||||
* The `id` is the `git_oid` of the item. If the entry represents an
|
||||
* absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
|
||||
* then the oid will be zeroes.
|
||||
*
|
||||
* `path` is the NUL-terminated path to the entry relative to the working
|
||||
* directory of the repository.
|
||||
*
|
||||
* `size` is the size of the entry in bytes.
|
||||
*
|
||||
* `flags` is a combination of the `git_diff_flag_t` types
|
||||
*
|
||||
* `mode` is, roughly, the stat() `st_mode` value for the item. This will
|
||||
* be restricted to one of the `git_filemode_t` values.
|
||||
*
|
||||
* The `id_abbrev` represents the known length of the `id` field, when
|
||||
* converted to a hex string. It is generally `GIT_OID_HEXSZ`, unless this
|
||||
* delta was created from reading a patch file, in which case it may be
|
||||
* abbreviated to something reasonable, like 7 characters.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* The `git_oid` of the item. If the entry represents an
|
||||
* absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
|
||||
* then the oid will be zeroes.
|
||||
*/
|
||||
git_oid id;
|
||||
|
||||
/**
|
||||
* The NUL-terminated path to the entry relative to the working
|
||||
* directory of the repository.
|
||||
*/
|
||||
const char *path;
|
||||
|
||||
/**
|
||||
* The size of the entry in bytes.
|
||||
*/
|
||||
git_object_size_t size;
|
||||
|
||||
/**
|
||||
* A combination of the `git_diff_flag_t` types
|
||||
*/
|
||||
uint32_t flags;
|
||||
|
||||
/**
|
||||
* Roughly, the stat() `st_mode` value for the item. This will
|
||||
* be restricted to one of the `git_filemode_t` values.
|
||||
*/
|
||||
uint16_t mode;
|
||||
|
||||
/**
|
||||
* Represents the known length of the `id` field, when
|
||||
* converted to a hex string. It is generally `GIT_OID_HEXSZ`, unless this
|
||||
* delta was created from reading a patch file, in which case it may be
|
||||
* abbreviated to something reasonable, like 7 characters.
|
||||
*/
|
||||
uint16_t id_abbrev;
|
||||
} git_diff_file;
|
||||
|
||||
|
|
|
@ -42,14 +42,14 @@ typedef enum {
|
|||
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_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_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_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 */
|
||||
|
|
|
@ -49,8 +49,33 @@ typedef enum {
|
|||
|
||||
/** Load attributes from `.gitattributes` in the root of HEAD */
|
||||
GIT_FILTER_ATTRIBUTES_FROM_HEAD = (1u << 2),
|
||||
|
||||
/**
|
||||
* Load attributes from `.gitattributes` in a given commit.
|
||||
* This can only be specified in a `git_filter_options`.
|
||||
*/
|
||||
GIT_FILTER_ATTRIBUTES_FROM_COMMIT = (1u << 3),
|
||||
} git_filter_flag_t;
|
||||
|
||||
/**
|
||||
* Filtering options
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version;
|
||||
|
||||
/** See `git_filter_flag_t` above */
|
||||
uint32_t flags;
|
||||
|
||||
/**
|
||||
* The commit to load attributes from, when
|
||||
* `GIT_FILTER_ATTRIBUTES_FROM_COMMIT` is specified.
|
||||
*/
|
||||
git_oid *commit_id;
|
||||
} git_filter_options;
|
||||
|
||||
#define GIT_FILTER_OPTIONS_VERSION 1
|
||||
#define GIT_FILTER_OPTIONS_INIT {GIT_FILTER_OPTIONS_VERSION}
|
||||
|
||||
/**
|
||||
* A filter that can transform file data
|
||||
*
|
||||
|
@ -103,6 +128,29 @@ GIT_EXTERN(int) git_filter_list_load(
|
|||
git_filter_mode_t mode,
|
||||
uint32_t flags);
|
||||
|
||||
/**
|
||||
* Load the filter list for a given path.
|
||||
*
|
||||
* This will return 0 (success) but set the output git_filter_list to NULL
|
||||
* if no filters are requested for the given file.
|
||||
*
|
||||
* @param filters Output newly created git_filter_list (or NULL)
|
||||
* @param repo Repository object that contains `path`
|
||||
* @param blob The blob to which the filter will be applied (if known)
|
||||
* @param path Relative path of the file to be filtered
|
||||
* @param mode Filtering direction (WT->ODB or ODB->WT)
|
||||
* @param opts The `git_filter_options` to use when loading filters
|
||||
* @return 0 on success (which could still return NULL if no filters are
|
||||
* needed for the requested file), <0 on error
|
||||
*/
|
||||
GIT_EXTERN(int) git_filter_list_load_ext(
|
||||
git_filter_list **filters,
|
||||
git_repository *repo,
|
||||
git_blob *blob,
|
||||
const char *path,
|
||||
git_filter_mode_t mode,
|
||||
git_filter_options *opts);
|
||||
|
||||
/**
|
||||
* Query the filter list to see if a given filter (by name) will run.
|
||||
* The built-in filters "crlf" and "ident" can be queried, otherwise this
|
||||
|
@ -122,27 +170,17 @@ GIT_EXTERN(int) git_filter_list_contains(
|
|||
/**
|
||||
* Apply filter list to a data buffer.
|
||||
*
|
||||
* See `git2/buffer.h` for background on `git_buf` objects.
|
||||
*
|
||||
* If the `in` buffer holds data allocated by libgit2 (i.e. `in->asize` is
|
||||
* not zero), then it will be overwritten when applying the filters. If
|
||||
* not, then it will be left untouched.
|
||||
*
|
||||
* If there are no filters to apply (or `filters` is NULL), then the `out`
|
||||
* buffer will reference the `in` buffer data (with `asize` set to zero)
|
||||
* instead of allocating data. This keeps allocations to a minimum, but
|
||||
* it means you have to be careful about freeing the `in` data since `out`
|
||||
* may be pointing to it!
|
||||
*
|
||||
* @param out Buffer to store the result of the filtering
|
||||
* @param filters A loaded git_filter_list (or NULL)
|
||||
* @param in Buffer containing the data to filter
|
||||
* @param in_len The length of the input buffer
|
||||
* @return 0 on success, an error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_filter_list_apply_to_data(
|
||||
GIT_EXTERN(int) git_filter_list_apply_to_buffer(
|
||||
git_buf *out,
|
||||
git_filter_list *filters,
|
||||
git_buf *in);
|
||||
const char *in,
|
||||
size_t in_len);
|
||||
|
||||
/**
|
||||
* Apply a filter list to the contents of a file on disk
|
||||
|
@ -175,12 +213,14 @@ GIT_EXTERN(int) git_filter_list_apply_to_blob(
|
|||
* Apply a filter list to an arbitrary buffer as a stream
|
||||
*
|
||||
* @param filters the list of filters to apply
|
||||
* @param data the buffer to filter
|
||||
* @param buffer the buffer to filter
|
||||
* @param len the size of the buffer
|
||||
* @param target the stream into which the data will be written
|
||||
*/
|
||||
GIT_EXTERN(int) git_filter_list_stream_data(
|
||||
GIT_EXTERN(int) git_filter_list_stream_buffer(
|
||||
git_filter_list *filters,
|
||||
git_buf *data,
|
||||
const char *buffer,
|
||||
size_t len,
|
||||
git_writestream *target);
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,8 +43,9 @@ GIT_EXTERN(int) git_graph_ahead_behind(size_t *ahead, size_t *behind, git_reposi
|
|||
* Note that a commit is not considered a descendant of itself, in contrast
|
||||
* to `git merge-base --is-ancestor`.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @param ancestor a potential ancestor commit.
|
||||
* @param repo the repository where the commits exist
|
||||
* @param commit a previously loaded commit
|
||||
* @param ancestor a potential ancestor commit
|
||||
* @return 1 if the given commit is a descendant of the potential ancestor,
|
||||
* 0 if not, error code otherwise.
|
||||
*/
|
||||
|
@ -53,6 +54,23 @@ GIT_EXTERN(int) git_graph_descendant_of(
|
|||
const git_oid *commit,
|
||||
const git_oid *ancestor);
|
||||
|
||||
/**
|
||||
* Determine if a commit is reachable from any of a list of commits by
|
||||
* following parent edges.
|
||||
*
|
||||
* @param repo the repository where the commits exist
|
||||
* @param commit a previously loaded commit
|
||||
* @param length the number of commits in the provided `descendant_array`
|
||||
* @param descendant_array oids of the commits
|
||||
* @return 1 if the given commit is an ancestor of any of the given potential
|
||||
* descendants, 0 if not, error code otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_graph_reachable_from_any(
|
||||
git_repository *repo,
|
||||
const git_oid *commit,
|
||||
const git_oid descendant_array[],
|
||||
size_t length);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
|
|
|
@ -702,7 +702,7 @@ GIT_EXTERN(int) git_index_update_all(
|
|||
* @param at_pos the address to which the position of the index entry is written (optional)
|
||||
* @param index an existing index object
|
||||
* @param path path to search
|
||||
* @return 0 with valid value in at_pos; an error code otherwise
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_find(size_t *at_pos, git_index *index, const char *path);
|
||||
|
||||
|
@ -713,7 +713,7 @@ GIT_EXTERN(int) git_index_find(size_t *at_pos, git_index *index, const char *pat
|
|||
* @param at_pos the address to which the position of the index entry is written (optional)
|
||||
* @param index an existing index object
|
||||
* @param prefix the prefix to search for
|
||||
* @return 0 with valid value in at_pos; an error code otherwise
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_find_prefix(size_t *at_pos, git_index *index, const char *prefix);
|
||||
|
||||
|
|
|
@ -390,6 +390,20 @@ GIT_EXTERN(int) git_odb_write_pack(
|
|||
git_indexer_progress_cb progress_cb,
|
||||
void *progress_payload);
|
||||
|
||||
/**
|
||||
* Write a `multi-pack-index` file from all the `.pack` files in the ODB.
|
||||
*
|
||||
* If the ODB layer understands pack files, then this will create a file called
|
||||
* `multi-pack-index` next to the `.pack` and `.idx` files, which will contain
|
||||
* an index of all objects stored in `.pack` files. This will allow for
|
||||
* O(log n) lookup for n objects (regardless of how many packfiles there
|
||||
* exist).
|
||||
*
|
||||
* @param db object database where the `multi-pack-index` file will be written.
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_write_multi_pack_index(
|
||||
git_odb *db);
|
||||
|
||||
/**
|
||||
* Determine the object-ID (sha1 hash) of a data buffer
|
||||
*
|
||||
|
@ -539,6 +553,21 @@ GIT_EXTERN(size_t) git_odb_num_backends(git_odb *odb);
|
|||
*/
|
||||
GIT_EXTERN(int) git_odb_get_backend(git_odb_backend **out, git_odb *odb, size_t pos);
|
||||
|
||||
/**
|
||||
* Set the git commit-graph for the ODB.
|
||||
*
|
||||
* After a successfull call, the ownership of the cgraph parameter will be
|
||||
* transferred to libgit2, and the caller should not free it.
|
||||
*
|
||||
* The commit-graph can also be unset by explicitly passing NULL as the cgraph
|
||||
* parameter.
|
||||
*
|
||||
* @param odb object database
|
||||
* @param cgraph the git commit-graph
|
||||
* @return 0 on success; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_set_commit_graph(git_odb *odb, git_commit_graph *cgraph);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,14 @@ GIT_BEGIN_DECL
|
|||
*/
|
||||
typedef struct git_patch git_patch;
|
||||
|
||||
/**
|
||||
* Get the repository associated with this patch. May be NULL.
|
||||
*
|
||||
* @param patch the patch
|
||||
* @return a pointer to the repository
|
||||
*/
|
||||
GIT_EXTERN(git_repository *) git_patch_owner(const git_patch *patch);
|
||||
|
||||
/**
|
||||
* Return a patch for an entry in the diff list.
|
||||
*
|
||||
|
|
|
@ -74,14 +74,38 @@ typedef struct {
|
|||
*/
|
||||
git_checkout_options checkout_options;
|
||||
|
||||
/**
|
||||
* Optional callback that allows users to override commit
|
||||
* creation in `git_rebase_commit`. If specified, users can
|
||||
* create their own commit and provide the commit ID, which
|
||||
* may be useful for signing commits or otherwise customizing
|
||||
* the commit creation.
|
||||
*
|
||||
* If this callback returns `GIT_PASSTHROUGH`, then
|
||||
* `git_rebase_commit` will continue to create the commit.
|
||||
*/
|
||||
git_commit_create_cb commit_create_cb;
|
||||
|
||||
#ifdef GIT_DEPRECATE_HARD
|
||||
void *reserved;
|
||||
#else
|
||||
/**
|
||||
* If provided, this will be called with the commit content, allowing
|
||||
* a signature to be added to the rebase commit. Can be skipped with
|
||||
* GIT_PASSTHROUGH. If GIT_PASSTHROUGH is returned, a commit will be made
|
||||
* without a signature.
|
||||
*
|
||||
* This field is only used when performing git_rebase_commit.
|
||||
*
|
||||
* This callback is not invoked if a `git_commit_create_cb` is
|
||||
* specified.
|
||||
*
|
||||
* This callback is deprecated; users should provide a
|
||||
* creation callback as `commit_create_cb` that produces a
|
||||
* commit buffer, signs it, and commits it.
|
||||
*/
|
||||
git_commit_signing_cb signing_cb;
|
||||
int (*signing_cb)(git_buf *, git_buf *, const char *, void *);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This will be passed to each of the callbacks in this struct
|
||||
|
|
|
@ -97,6 +97,9 @@ GIT_EXTERN(int) git_reference_dwim(git_reference **out, git_repository *repo, co
|
|||
* of updating does not match the one passed through `current_value`
|
||||
* (i.e. if the ref has changed since the user read it).
|
||||
*
|
||||
* If `current_value` is all zeros, this function will return GIT_EMODIFIED
|
||||
* if the ref already exists.
|
||||
*
|
||||
* @param out Pointer to the newly created reference
|
||||
* @param repo Repository where that reference will live
|
||||
* @param name The name of the reference
|
||||
|
@ -743,10 +746,11 @@ GIT_EXTERN(int) git_reference_peel(
|
|||
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
|
||||
* sequences ".." and "@{" which have special meaning to revparse.
|
||||
*
|
||||
* @param valid output pointer to set with validity of given reference name
|
||||
* @param refname name to be checked.
|
||||
* @return 1 if the reference name is acceptable; 0 if it isn't
|
||||
* @return 0 on success or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_is_valid_name(const char *refname);
|
||||
GIT_EXTERN(int) git_reference_name_is_valid(int *valid, const char *refname);
|
||||
|
||||
/**
|
||||
* Get the reference's short name
|
||||
|
|
|
@ -212,7 +212,8 @@ GIT_EXTERN(const char *) git_remote_name(const git_remote *remote);
|
|||
* Get the remote's url
|
||||
*
|
||||
* If url.*.insteadOf has been configured for this URL, it will
|
||||
* return the modified URL.
|
||||
* return the modified URL. If `git_remote_set_instance_pushurl`
|
||||
* has been called for this remote, then that URL will be returned.
|
||||
*
|
||||
* @param remote the remote
|
||||
* @return a pointer to the url
|
||||
|
@ -220,10 +221,11 @@ GIT_EXTERN(const char *) git_remote_name(const git_remote *remote);
|
|||
GIT_EXTERN(const char *) git_remote_url(const git_remote *remote);
|
||||
|
||||
/**
|
||||
* Get the remote's url for pushing
|
||||
* Get the remote's url for pushing.
|
||||
*
|
||||
* If url.*.pushInsteadOf has been configured for this URL, it
|
||||
* will return the modified URL.
|
||||
* will return the modified URL. If `git_remote_set_instance_pushurl`
|
||||
* has been called for this remote, then that URL will be returned.
|
||||
*
|
||||
* @param remote the remote
|
||||
* @return a pointer to the url or NULL if no special url for pushing is set
|
||||
|
@ -253,9 +255,30 @@ GIT_EXTERN(int) git_remote_set_url(git_repository *repo, const char *remote, con
|
|||
* @param repo the repository in which to perform the change
|
||||
* @param remote the remote's name
|
||||
* @param url the url to set
|
||||
* @return 0, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_pushurl(git_repository *repo, const char *remote, const char* url);
|
||||
|
||||
/**
|
||||
* Set the url for this particular url instance. The URL in the
|
||||
* configuration will be ignored, and will not be changed.
|
||||
*
|
||||
* @param remote the remote's name
|
||||
* @param url the url to set
|
||||
* @return 0 or an error value
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_instance_url(git_remote *remote, const char *url);
|
||||
|
||||
/**
|
||||
* Set the push url for this particular url instance. The URL in the
|
||||
* configuration will be ignored, and will not be changed.
|
||||
*
|
||||
* @param remote the remote's name
|
||||
* @param url the url to set
|
||||
* @return 0 or an error value
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_instance_pushurl(git_remote *remote, const char *url);
|
||||
|
||||
/**
|
||||
* Add a fetch refspec to the remote's configuration
|
||||
*
|
||||
|
@ -476,6 +499,7 @@ typedef int GIT_CALLBACK(git_push_negotiation)(const git_push_update **updates,
|
|||
*/
|
||||
typedef int GIT_CALLBACK(git_push_update_reference_cb)(const char *refname, const char *status, void *data);
|
||||
|
||||
#ifndef GIT_DEPRECATE_HARD
|
||||
/**
|
||||
* Callback to resolve URLs before connecting to remote
|
||||
*
|
||||
|
@ -487,8 +511,22 @@ typedef int GIT_CALLBACK(git_push_update_reference_cb)(const char *refname, cons
|
|||
* @param direction GIT_DIRECTION_FETCH or GIT_DIRECTION_PUSH
|
||||
* @param payload Payload provided by the caller
|
||||
* @return 0 on success, GIT_PASSTHROUGH or an error
|
||||
* @deprecated Use `git_remote_set_instance_url`
|
||||
*/
|
||||
typedef int GIT_CALLBACK(git_url_resolve_cb)(git_buf *url_resolved, const char *url, int direction, void *payload);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Callback invoked immediately before we attempt to connect to the
|
||||
* given url. Callers may change the URL before the connection by
|
||||
* calling `git_remote_set_instance_url` in the callback.
|
||||
*
|
||||
* @param remote The remote to be connected
|
||||
* @param direction GIT_DIRECTION_FETCH or GIT_DIRECTION_PUSH
|
||||
* @param payload Payload provided by the caller
|
||||
* @return 0 on success, or an error
|
||||
*/
|
||||
typedef int GIT_CALLBACK(git_remote_ready_cb)(git_remote *remote, int direction, void *payload);
|
||||
|
||||
/**
|
||||
* The callback settings structure
|
||||
|
@ -574,17 +612,29 @@ struct git_remote_callbacks {
|
|||
*/
|
||||
git_transport_cb transport;
|
||||
|
||||
/**
|
||||
* Callback when the remote is ready to connect.
|
||||
*/
|
||||
git_remote_ready_cb remote_ready;
|
||||
|
||||
/**
|
||||
* This will be passed to each of the callbacks in this struct
|
||||
* as the last parameter.
|
||||
*/
|
||||
void *payload;
|
||||
|
||||
#ifdef GIT_DEPRECATE_HARD
|
||||
void *reserved;
|
||||
#else
|
||||
/**
|
||||
* Resolve URL before connecting to remote.
|
||||
* The returned URL will be used to connect to the remote instead.
|
||||
*
|
||||
* This callback is deprecated; users should use
|
||||
* git_remote_ready_cb and configure the instance URL instead.
|
||||
*/
|
||||
git_url_resolve_cb resolve_url;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define GIT_REMOTE_CALLBACKS_VERSION 1
|
||||
|
@ -876,8 +926,10 @@ GIT_EXTERN(git_remote_autotag_option_t) git_remote_autotag(const git_remote *rem
|
|||
* @param repo the repository in which to make the change
|
||||
* @param remote the name of the remote
|
||||
* @param value the new value to take.
|
||||
* @return 0, or an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_autotag(git_repository *repo, const char *remote, git_remote_autotag_option_t value);
|
||||
|
||||
/**
|
||||
* Retrieve the ref-prune setting
|
||||
*
|
||||
|
@ -915,10 +967,11 @@ GIT_EXTERN(int) git_remote_rename(
|
|||
/**
|
||||
* Ensure the remote name is well-formed.
|
||||
*
|
||||
* @param valid output pointer to set with validity of given remote name
|
||||
* @param remote_name name to be checked.
|
||||
* @return 1 if the reference name is acceptable; 0 if it isn't
|
||||
* @return 0 on success or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_is_valid_name(const char *remote_name);
|
||||
int git_remote_name_is_valid(int *valid, const char *remote_name);
|
||||
|
||||
/**
|
||||
* Delete an existing persisted remote.
|
||||
|
@ -943,7 +996,7 @@ GIT_EXTERN(int) git_remote_delete(git_repository *repo, const char *name);
|
|||
*
|
||||
* This function must only be called after connecting.
|
||||
*
|
||||
* @param out the buffern in which to store the reference name
|
||||
* @param out the buffer in which to store the reference name
|
||||
* @param remote the remote
|
||||
* @return 0, GIT_ENOTFOUND if the remote does not have any references
|
||||
* or none of them point to HEAD's commit, or an error message.
|
||||
|
|
|
@ -70,12 +70,12 @@ GIT_EXTERN(int) git_revparse_ext(
|
|||
*/
|
||||
typedef enum {
|
||||
/** The spec targeted a single object. */
|
||||
GIT_REVPARSE_SINGLE = 1 << 0,
|
||||
GIT_REVSPEC_SINGLE = 1 << 0,
|
||||
/** The spec targeted a range of commits. */
|
||||
GIT_REVPARSE_RANGE = 1 << 1,
|
||||
GIT_REVSPEC_RANGE = 1 << 1,
|
||||
/** The spec used the '...' operator, which invokes special semantics. */
|
||||
GIT_REVPARSE_MERGE_BASE = 1 << 2,
|
||||
} git_revparse_mode_t;
|
||||
GIT_REVSPEC_MERGE_BASE = 1 << 2,
|
||||
} git_revspec_t;
|
||||
|
||||
/**
|
||||
* Git Revision Spec: output of a `git_revparse` operation
|
||||
|
@ -85,7 +85,7 @@ typedef struct {
|
|||
git_object *from;
|
||||
/** The right element of the revspec; must be freed by the user */
|
||||
git_object *to;
|
||||
/** The intent of the revspec (i.e. `git_revparse_mode_t` flags) */
|
||||
/** The intent of the revspec (i.e. `git_revspec_mode_t` flags) */
|
||||
unsigned int flags;
|
||||
} git_revspec;
|
||||
|
||||
|
|
|
@ -69,89 +69,141 @@ typedef int GIT_CALLBACK(git_status_cb)(
|
|||
* With `git_status_foreach_ext`, this will control which changes get
|
||||
* callbacks. With `git_status_list_new`, these will control which
|
||||
* changes are included in the list.
|
||||
*
|
||||
* - GIT_STATUS_SHOW_INDEX_AND_WORKDIR is the default. This roughly
|
||||
* matches `git status --porcelain` regarding which files are
|
||||
* included and in what order.
|
||||
* - GIT_STATUS_SHOW_INDEX_ONLY only gives status based on HEAD to index
|
||||
* comparison, not looking at working directory changes.
|
||||
* - GIT_STATUS_SHOW_WORKDIR_ONLY only gives status based on index to
|
||||
* working directory comparison, not comparing the index to the HEAD.
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
* The default. This roughly matches `git status --porcelain` regarding
|
||||
* which files are included and in what order.
|
||||
*/
|
||||
GIT_STATUS_SHOW_INDEX_AND_WORKDIR = 0,
|
||||
|
||||
/**
|
||||
* Only gives status based on HEAD to index comparison, not looking at
|
||||
* working directory changes.
|
||||
*/
|
||||
GIT_STATUS_SHOW_INDEX_ONLY = 1,
|
||||
|
||||
/**
|
||||
* Only gives status based on index to working directory comparison,
|
||||
* not comparing the index to the HEAD.
|
||||
*/
|
||||
GIT_STATUS_SHOW_WORKDIR_ONLY = 2,
|
||||
} git_status_show_t;
|
||||
|
||||
/**
|
||||
* Flags to control status callbacks
|
||||
*
|
||||
* - GIT_STATUS_OPT_INCLUDE_UNTRACKED says that callbacks should be made
|
||||
* on untracked files. These will only be made if the workdir files are
|
||||
* included in the status "show" option.
|
||||
* - GIT_STATUS_OPT_INCLUDE_IGNORED says that ignored files get callbacks.
|
||||
* Again, these callbacks will only be made if the workdir files are
|
||||
* included in the status "show" option.
|
||||
* - GIT_STATUS_OPT_INCLUDE_UNMODIFIED indicates that callback should be
|
||||
* made even on unmodified files.
|
||||
* - GIT_STATUS_OPT_EXCLUDE_SUBMODULES indicates that submodules should be
|
||||
* skipped. This only applies if there are no pending typechanges to
|
||||
* the submodule (either from or to another type).
|
||||
* - GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS indicates that all files in
|
||||
* untracked directories should be included. Normally if an entire
|
||||
* directory is new, then just the top-level directory is included (with
|
||||
* a trailing slash on the entry name). This flag says to include all
|
||||
* of the individual files in the directory instead.
|
||||
* - GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH indicates that the given path
|
||||
* should be treated as a literal path, and not as a pathspec pattern.
|
||||
* - GIT_STATUS_OPT_RECURSE_IGNORED_DIRS indicates that the contents of
|
||||
* ignored directories should be included in the status. This is like
|
||||
* doing `git ls-files -o -i --exclude-standard` with core git.
|
||||
* - GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX indicates that rename detection
|
||||
* should be processed between the head and the index and enables
|
||||
* the GIT_STATUS_INDEX_RENAMED as a possible status flag.
|
||||
* - GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR indicates that rename
|
||||
* detection should be run between the index and the working directory
|
||||
* and enabled GIT_STATUS_WT_RENAMED as a possible status flag.
|
||||
* - GIT_STATUS_OPT_SORT_CASE_SENSITIVELY overrides the native case
|
||||
* sensitivity for the file system and forces the output to be in
|
||||
* case-sensitive order
|
||||
* - GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY overrides the native case
|
||||
* sensitivity for the file system and forces the output to be in
|
||||
* case-insensitive order
|
||||
* - GIT_STATUS_OPT_RENAMES_FROM_REWRITES indicates that rename detection
|
||||
* should include rewritten files
|
||||
* - GIT_STATUS_OPT_NO_REFRESH bypasses the default status behavior of
|
||||
* doing a "soft" index reload (i.e. reloading the index data if the
|
||||
* file on disk has been modified outside libgit2).
|
||||
* - GIT_STATUS_OPT_UPDATE_INDEX tells libgit2 to refresh the stat cache
|
||||
* in the index for files that are unchanged but have out of date stat
|
||||
* information in the index. It will result in less work being done on
|
||||
* subsequent calls to get status. This is mutually exclusive with the
|
||||
* NO_REFRESH option.
|
||||
*
|
||||
* Calling `git_status_foreach()` is like calling the extended version
|
||||
* with: GIT_STATUS_OPT_INCLUDE_IGNORED, GIT_STATUS_OPT_INCLUDE_UNTRACKED,
|
||||
* and GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS. Those options are bundled
|
||||
* together as `GIT_STATUS_OPT_DEFAULTS` if you want them as a baseline.
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
* Says that callbacks should be made on untracked files.
|
||||
* These will only be made if the workdir files are included in the status
|
||||
* "show" option.
|
||||
*/
|
||||
GIT_STATUS_OPT_INCLUDE_UNTRACKED = (1u << 0),
|
||||
|
||||
/**
|
||||
* Says that ignored files get callbacks.
|
||||
* Again, these callbacks will only be made if the workdir files are
|
||||
* included in the status "show" option.
|
||||
*/
|
||||
GIT_STATUS_OPT_INCLUDE_IGNORED = (1u << 1),
|
||||
|
||||
/**
|
||||
* Indicates that callback should be made even on unmodified files.
|
||||
*/
|
||||
GIT_STATUS_OPT_INCLUDE_UNMODIFIED = (1u << 2),
|
||||
|
||||
/**
|
||||
* Indicates that submodules should be skipped.
|
||||
* This only applies if there are no pending typechanges to the submodule
|
||||
* (either from or to another type).
|
||||
*/
|
||||
GIT_STATUS_OPT_EXCLUDE_SUBMODULES = (1u << 3),
|
||||
|
||||
/**
|
||||
* Indicates that all files in untracked directories should be included.
|
||||
* Normally if an entire directory is new, then just the top-level
|
||||
* directory is included (with a trailing slash on the entry name).
|
||||
* This flag says to include all of the individual files in the directory
|
||||
* instead.
|
||||
*/
|
||||
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = (1u << 4),
|
||||
|
||||
/**
|
||||
* Indicates that the given path should be treated as a literal path,
|
||||
* and not as a pathspec pattern.
|
||||
*/
|
||||
GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH = (1u << 5),
|
||||
|
||||
/**
|
||||
* Indicates that the contents of ignored directories should be included
|
||||
* in the status. This is like doing `git ls-files -o -i --exclude-standard`
|
||||
* with core git.
|
||||
*/
|
||||
GIT_STATUS_OPT_RECURSE_IGNORED_DIRS = (1u << 6),
|
||||
|
||||
/**
|
||||
* Indicates that rename detection should be processed between the head and
|
||||
* the index and enables the GIT_STATUS_INDEX_RENAMED as a possible status
|
||||
* flag.
|
||||
*/
|
||||
GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX = (1u << 7),
|
||||
|
||||
/**
|
||||
* Indicates that rename detection should be run between the index and the
|
||||
* working directory and enabled GIT_STATUS_WT_RENAMED as a possible status
|
||||
* flag.
|
||||
*/
|
||||
GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR = (1u << 8),
|
||||
|
||||
/**
|
||||
* Overrides the native case sensitivity for the file system and forces
|
||||
* the output to be in case-sensitive order.
|
||||
*/
|
||||
GIT_STATUS_OPT_SORT_CASE_SENSITIVELY = (1u << 9),
|
||||
|
||||
/**
|
||||
* Overrides the native case sensitivity for the file system and forces
|
||||
* the output to be in case-insensitive order.
|
||||
*/
|
||||
GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY = (1u << 10),
|
||||
|
||||
/**
|
||||
* Iindicates that rename detection should include rewritten files.
|
||||
*/
|
||||
GIT_STATUS_OPT_RENAMES_FROM_REWRITES = (1u << 11),
|
||||
|
||||
/**
|
||||
* Bypasses the default status behavior of doing a "soft" index reload
|
||||
* (i.e. reloading the index data if the file on disk has been modified
|
||||
* outside libgit2).
|
||||
*/
|
||||
GIT_STATUS_OPT_NO_REFRESH = (1u << 12),
|
||||
|
||||
/**
|
||||
* Tells libgit2 to refresh the stat cache in the index for files that are
|
||||
* unchanged but have out of date stat einformation in the index.
|
||||
* It will result in less work being done on subsequent calls to get status.
|
||||
* This is mutually exclusive with the NO_REFRESH option.
|
||||
*/
|
||||
GIT_STATUS_OPT_UPDATE_INDEX = (1u << 13),
|
||||
|
||||
/**
|
||||
* Normally files that cannot be opened or read are ignored as
|
||||
* these are often transient files; this option will return
|
||||
* unreadable files as `GIT_STATUS_WT_UNREADABLE`.
|
||||
*/
|
||||
GIT_STATUS_OPT_INCLUDE_UNREADABLE = (1u << 14),
|
||||
|
||||
/**
|
||||
* Unreadable files will be detected and given the status
|
||||
* untracked instead of unreadable.
|
||||
*/
|
||||
GIT_STATUS_OPT_INCLUDE_UNREADABLE_AS_UNTRACKED = (1u << 15),
|
||||
} git_status_opt_t;
|
||||
|
||||
|
@ -168,7 +220,10 @@ typedef enum {
|
|||
*
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version; /**< The version */
|
||||
/**
|
||||
* The struct version; pass `GIT_STATUS_OPTIONS_VERSION`.
|
||||
*/
|
||||
unsigned int version;
|
||||
|
||||
/**
|
||||
* The `show` value is one of the `git_status_show_t` constants that
|
||||
|
@ -177,21 +232,22 @@ typedef struct {
|
|||
git_status_show_t show;
|
||||
|
||||
/**
|
||||
* The `flags` value is an OR'ed combination of the `git_status_opt_t`
|
||||
* values above.
|
||||
* The `flags` value is an OR'ed combination of the
|
||||
* `git_status_opt_t` values above.
|
||||
*/
|
||||
unsigned int flags;
|
||||
|
||||
/**
|
||||
* The `pathspec` is an array of path patterns to match (using
|
||||
* fnmatch-style matching), or just an array of paths to match exactly if
|
||||
* `GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH` is specified in the flags.
|
||||
* fnmatch-style matching), or just an array of paths to match
|
||||
* exactly if `GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH` is specified
|
||||
* in the flags.
|
||||
*/
|
||||
git_strarray pathspec;
|
||||
|
||||
/**
|
||||
* The `baseline` is the tree to be used for comparison to the working directory
|
||||
* and index; defaults to HEAD.
|
||||
* The `baseline` is the tree to be used for comparison to the
|
||||
* working directory and index; defaults to HEAD.
|
||||
*/
|
||||
git_tree *baseline;
|
||||
} git_status_options;
|
||||
|
|
|
@ -223,6 +223,15 @@ GIT_EXTERN(int) git_submodule_lookup(
|
|||
git_repository *repo,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Create an in-memory copy of a submodule. The copy must be explicitly
|
||||
* free'd or it will leak.
|
||||
*
|
||||
* @param out Pointer to store the copy of the submodule.
|
||||
* @param source Original submodule to copy.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_dup(git_submodule **out, git_submodule *source);
|
||||
|
||||
/**
|
||||
* Release a submodule
|
||||
*
|
||||
|
|
174
libgit2/headers/git2/sys/commit_graph.h
Normal file
174
libgit2/headers/git2/sys/commit_graph.h
Normal file
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_sys_git_commit_graph_h__
|
||||
#define INCLUDE_sys_git_commit_graph_h__
|
||||
|
||||
#include "git2/common.h"
|
||||
#include "git2/types.h"
|
||||
|
||||
/**
|
||||
* @file git2/sys/commit_graph.h
|
||||
* @brief Git commit-graph
|
||||
* @defgroup git_commit_graph Git commit-graph APIs
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Opens a `git_commit_graph` from a path to an objects directory.
|
||||
*
|
||||
* This finds, opens, and validates the `commit-graph` file.
|
||||
*
|
||||
* @param cgraph_out the `git_commit_graph` struct to initialize.
|
||||
* @param objects_dir the path to a git objects directory.
|
||||
* @return Zero on success; -1 on failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_graph_open(git_commit_graph **cgraph_out, const char *objects_dir);
|
||||
|
||||
/**
|
||||
* Frees commit-graph data. This should only be called when memory allocated
|
||||
* using `git_commit_graph_open` is not returned to libgit2 because it was not
|
||||
* associated with the ODB through a successful call to
|
||||
* `git_odb_set_commit_graph`.
|
||||
*
|
||||
* @param cgraph the commit-graph object to free. If NULL, no action is taken.
|
||||
*/
|
||||
GIT_EXTERN(void) git_commit_graph_free(git_commit_graph *cgraph);
|
||||
|
||||
/**
|
||||
* Create a new writer for `commit-graph` files.
|
||||
*
|
||||
* @param out Location to store the writer pointer.
|
||||
* @param objects_info_dir The `objects/info` directory.
|
||||
* The `commit-graph` file will be written in this directory.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_graph_writer_new(
|
||||
git_commit_graph_writer **out,
|
||||
const char *objects_info_dir);
|
||||
|
||||
/**
|
||||
* Free the commit-graph writer and its resources.
|
||||
*
|
||||
* @param w The writer to free. If NULL no action is taken.
|
||||
*/
|
||||
GIT_EXTERN(void) git_commit_graph_writer_free(git_commit_graph_writer *w);
|
||||
|
||||
/**
|
||||
* Add an `.idx` file (associated to a packfile) to the writer.
|
||||
*
|
||||
* @param w The writer.
|
||||
* @param repo The repository that owns the `.idx` file.
|
||||
* @param idx_path The path of an `.idx` file.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_graph_writer_add_index_file(
|
||||
git_commit_graph_writer *w,
|
||||
git_repository *repo,
|
||||
const char *idx_path);
|
||||
|
||||
/**
|
||||
* Add a revwalk to the writer. This will add all the commits from the revwalk
|
||||
* to the commit-graph.
|
||||
*
|
||||
* @param w The writer.
|
||||
* @param walk The git_revwalk.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_graph_writer_add_revwalk(
|
||||
git_commit_graph_writer *w,
|
||||
git_revwalk *walk);
|
||||
|
||||
|
||||
/**
|
||||
* The strategy to use when adding a new set of commits to a pre-existing
|
||||
* commit-graph chain.
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
* Do not split commit-graph files. The other split strategy-related option
|
||||
* fields are ignored.
|
||||
*/
|
||||
GIT_COMMIT_GRAPH_SPLIT_STRATEGY_SINGLE_FILE = 0,
|
||||
} git_commit_graph_split_strategy_t;
|
||||
|
||||
/**
|
||||
* Options structure for
|
||||
* `git_commit_graph_writer_commit`/`git_commit_graph_writer_dump`.
|
||||
*
|
||||
* Initialize with `GIT_COMMIT_GRAPH_WRITER_OPTIONS_INIT`. Alternatively, you
|
||||
* can use `git_commit_graph_writer_options_init`.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version;
|
||||
|
||||
/**
|
||||
* The strategy to use when adding new commits to a pre-existing commit-graph
|
||||
* chain.
|
||||
*/
|
||||
git_commit_graph_split_strategy_t split_strategy;
|
||||
|
||||
/**
|
||||
* The number of commits in level N is less than X times the number of
|
||||
* commits in level N + 1. Default is 2.
|
||||
*/
|
||||
float size_multiple;
|
||||
|
||||
/**
|
||||
* The number of commits in level N + 1 is more than C commits.
|
||||
* Default is 64000.
|
||||
*/
|
||||
size_t max_commits;
|
||||
} git_commit_graph_writer_options;
|
||||
|
||||
#define GIT_COMMIT_GRAPH_WRITER_OPTIONS_VERSION 1
|
||||
#define GIT_COMMIT_GRAPH_WRITER_OPTIONS_INIT { \
|
||||
GIT_COMMIT_GRAPH_WRITER_OPTIONS_VERSION \
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize git_commit_graph_writer_options structure
|
||||
*
|
||||
* Initializes a `git_commit_graph_writer_options` with default values. Equivalent to
|
||||
* creating an instance with `GIT_COMMIT_GRAPH_WRITER_OPTIONS_INIT`.
|
||||
*
|
||||
* @param opts The `git_commit_graph_writer_options` struct to initialize.
|
||||
* @param version The struct version; pass `GIT_COMMIT_GRAPH_WRITER_OPTIONS_VERSION`.
|
||||
* @return Zero on success; -1 on failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_graph_writer_options_init(
|
||||
git_commit_graph_writer_options *opts,
|
||||
unsigned int version);
|
||||
|
||||
/**
|
||||
* Write a `commit-graph` file to a file.
|
||||
*
|
||||
* @param w The writer
|
||||
* @param opts Pointer to git_commit_graph_writer_options struct.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_graph_writer_commit(
|
||||
git_commit_graph_writer *w,
|
||||
git_commit_graph_writer_options *opts);
|
||||
|
||||
/**
|
||||
* Dump the contents of the `commit-graph` to an in-memory buffer.
|
||||
*
|
||||
* @param buffer Buffer where to store the contents of the `commit-graph`.
|
||||
* @param w The writer.
|
||||
* @param opts Pointer to git_commit_graph_writer_options struct.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_graph_writer_dump(
|
||||
git_buf *buffer,
|
||||
git_commit_graph_writer *w,
|
||||
git_commit_graph_writer_options *opts);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
|
@ -167,17 +167,18 @@ typedef void GIT_CALLBACK(git_filter_shutdown_fn)(git_filter *self);
|
|||
*
|
||||
* The `payload` will be a pointer to a reference payload for the filter.
|
||||
* This will start as NULL, but `check` can assign to this pointer for
|
||||
* later use by the `apply` callback. Note that the value should be heap
|
||||
* allocated (not stack), so that it doesn't go away before the `apply`
|
||||
* later use by the `stream` callback. Note that the value should be heap
|
||||
* allocated (not stack), so that it doesn't go away before the `stream`
|
||||
* 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.
|
||||
*/
|
||||
typedef int GIT_CALLBACK(git_filter_check_fn)(
|
||||
git_filter *self,
|
||||
void **payload, /* points to NULL ptr on entry, may be set */
|
||||
git_filter *self,
|
||||
void **payload, /* NULL on entry, may be set */
|
||||
const git_filter_source *src,
|
||||
const char **attr_values);
|
||||
const char **attr_values);
|
||||
|
||||
#ifndef GIT_DEPRECATE_HARD
|
||||
/**
|
||||
* Callback to actually perform the data filtering
|
||||
*
|
||||
|
@ -189,32 +190,45 @@ typedef int GIT_CALLBACK(git_filter_check_fn)(
|
|||
*
|
||||
* 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.
|
||||
*
|
||||
* @deprecated use git_filter_stream_fn
|
||||
*/
|
||||
typedef int GIT_CALLBACK(git_filter_apply_fn)(
|
||||
git_filter *self,
|
||||
void **payload, /* may be read and/or set */
|
||||
git_buf *to,
|
||||
const git_buf *from,
|
||||
git_filter *self,
|
||||
void **payload, /* may be read and/or set */
|
||||
git_buf *to,
|
||||
const git_buf *from,
|
||||
const git_filter_source *src);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Callback to perform the data filtering.
|
||||
*
|
||||
* Specified as `filter.stream`, this is a callback that filters data
|
||||
* in a streaming manner. This function will provide a
|
||||
* `git_writestream` that will the original data will be written to;
|
||||
* with that data, the `git_writestream` will then perform the filter
|
||||
* translation and stream the filtered data out to the `next` location.
|
||||
*/
|
||||
typedef int GIT_CALLBACK(git_filter_stream_fn)(
|
||||
git_writestream **out,
|
||||
git_filter *self,
|
||||
void **payload,
|
||||
git_writestream **out,
|
||||
git_filter *self,
|
||||
void **payload,
|
||||
const git_filter_source *src,
|
||||
git_writestream *next);
|
||||
git_writestream *next);
|
||||
|
||||
/**
|
||||
* Callback to clean up after filtering has been applied
|
||||
*
|
||||
* Specified as `filter.cleanup`, this is an optional callback invoked
|
||||
* 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.
|
||||
* after the filter has been applied. If the `check`, `apply`, or
|
||||
* `stream` callbacks allocated a `payload` to keep per-source filter
|
||||
* state, use this callback to free that payload and release resources
|
||||
* as required.
|
||||
*/
|
||||
typedef void GIT_CALLBACK(git_filter_cleanup_fn)(
|
||||
git_filter *self,
|
||||
void *payload);
|
||||
git_filter *self,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Filter structure used to register custom filters.
|
||||
|
@ -248,21 +262,28 @@ struct git_filter {
|
|||
/**
|
||||
* Called to determine whether the filter should be invoked for a
|
||||
* given file. If this function returns `GIT_PASSTHROUGH` then the
|
||||
* `apply` function will not be invoked and the contents will be passed
|
||||
* through unmodified.
|
||||
* `stream` or `apply` functions will not be invoked and the
|
||||
* contents will be passed through unmodified.
|
||||
*/
|
||||
git_filter_check_fn check;
|
||||
|
||||
#ifdef GIT_DEPRECATE_HARD
|
||||
void *reserved;
|
||||
#else
|
||||
/**
|
||||
* Called to actually apply the filter to file contents. If this
|
||||
* function returns `GIT_PASSTHROUGH` then the contents will be passed
|
||||
* through unmodified.
|
||||
* Provided for backward compatibility; this will apply the
|
||||
* filter to the given contents in a `git_buf`. Callers should
|
||||
* provide a `stream` function instead.
|
||||
*/
|
||||
git_filter_apply_fn apply;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Called to apply the filter in a streaming manner. If this is not
|
||||
* specified then the system will call `apply` with the whole buffer.
|
||||
* Called to apply the filter, this function will provide a
|
||||
* `git_writestream` that will the original data will be
|
||||
* written to; with that data, the `git_writestream` will then
|
||||
* perform the filter translation and stream the filtered data
|
||||
* out to the `next` location.
|
||||
*/
|
||||
git_filter_stream_fn stream;
|
||||
|
||||
|
@ -289,9 +310,9 @@ GIT_EXTERN(int) git_filter_init(git_filter *filter, unsigned int version);
|
|||
* As mentioned elsewhere, the initialize callback will not be invoked
|
||||
* immediately. It is deferred until the filter is used in some way.
|
||||
*
|
||||
* A filter's attribute checks and `check` and `apply` callbacks will be
|
||||
* issued in order of `priority` on smudge (to workdir), and in reverse
|
||||
* order of `priority` on clean (to odb).
|
||||
* A filter's attribute checks and `check` and `stream` (or `apply`)
|
||||
* callbacks will be issued in order of `priority` on smudge (to
|
||||
* workdir), and in reverse order of `priority` on clean (to odb).
|
||||
*
|
||||
* Two filters are preregistered with libgit2:
|
||||
* - GIT_FILTER_CRLF with priority 0
|
||||
|
|
74
libgit2/headers/git2/sys/midx.h
Normal file
74
libgit2/headers/git2/sys/midx.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_sys_git_midx_h__
|
||||
#define INCLUDE_sys_git_midx_h__
|
||||
|
||||
#include "git2/common.h"
|
||||
#include "git2/types.h"
|
||||
|
||||
/**
|
||||
* @file git2/midx.h
|
||||
* @brief Git multi-pack-index routines
|
||||
* @defgroup git_midx Git multi-pack-index routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Create a new writer for `multi-pack-index` files.
|
||||
*
|
||||
* @param out location to store the writer pointer.
|
||||
* @param pack_dir the directory where the `.pack` and `.idx` files are. The
|
||||
* `multi-pack-index` file will be written in this directory, too.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_midx_writer_new(
|
||||
git_midx_writer **out,
|
||||
const char *pack_dir);
|
||||
|
||||
/**
|
||||
* Free the multi-pack-index writer and its resources.
|
||||
*
|
||||
* @param w the writer to free. If NULL no action is taken.
|
||||
*/
|
||||
GIT_EXTERN(void) git_midx_writer_free(git_midx_writer *w);
|
||||
|
||||
/**
|
||||
* Add an `.idx` file to the writer.
|
||||
*
|
||||
* @param w the writer
|
||||
* @param idx_path the path of an `.idx` file.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_midx_writer_add(
|
||||
git_midx_writer *w,
|
||||
const char *idx_path);
|
||||
|
||||
/**
|
||||
* Write a `multi-pack-index` file to a file.
|
||||
*
|
||||
* @param w the writer
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_midx_writer_commit(
|
||||
git_midx_writer *w);
|
||||
|
||||
/**
|
||||
* Dump the contents of the `multi-pack-index` to an in-memory buffer.
|
||||
*
|
||||
* @param midx Buffer where to store the contents of the `multi-pack-index`.
|
||||
* @param w the writer
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_midx_writer_dump(
|
||||
git_buf *midx,
|
||||
git_midx_writer *w);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
|
@ -84,6 +84,13 @@ struct git_odb_backend {
|
|||
git_odb_writepack **, git_odb_backend *, git_odb *odb,
|
||||
git_indexer_progress_cb progress_cb, void *progress_payload);
|
||||
|
||||
/**
|
||||
* If the backend supports pack files, this will create a
|
||||
* `multi-pack-index` file which will contain an index of all objects
|
||||
* across all the `.pack` files.
|
||||
*/
|
||||
int GIT_CALLBACK(writemidx)(git_odb_backend *);
|
||||
|
||||
/**
|
||||
* "Freshens" an already existing object, updating its last-used
|
||||
* time. This occurs when `git_odb_write` was called, but the
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#define INCLUDE_sys_git_transport_h
|
||||
|
||||
#include "git2/net.h"
|
||||
#include "git2/transport.h"
|
||||
#include "git2/types.h"
|
||||
#include "git2/strarray.h"
|
||||
#include "git2/proxy.h"
|
||||
|
|
|
@ -365,6 +365,18 @@ GIT_EXTERN(int) git_tag_peel(
|
|||
*/
|
||||
GIT_EXTERN(int) git_tag_dup(git_tag **out, git_tag *source);
|
||||
|
||||
/**
|
||||
* Determine whether a tag name is valid, meaning that (when prefixed
|
||||
* with `refs/tags/`) that it is a valid reference name, and that any
|
||||
* additional tag name restrictions are imposed (eg, it cannot start
|
||||
* with a `-`).
|
||||
*
|
||||
* @param valid output pointer to set with validity of given tag name
|
||||
* @param name a tag name to test
|
||||
* @return 0 on success or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_name_is_valid(int *valid, const char *name);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
|
|
|
@ -379,20 +379,6 @@ GIT_EXTERN(int) git_treebuilder_filter(
|
|||
GIT_EXTERN(int) git_treebuilder_write(
|
||||
git_oid *id, git_treebuilder *bld);
|
||||
|
||||
/**
|
||||
* Write the contents of the tree builder as a tree object
|
||||
* using a shared git_buf.
|
||||
*
|
||||
* @see git_treebuilder_write
|
||||
*
|
||||
* @param oid Pointer to store the OID of the newly written tree
|
||||
* @param bld Tree builder to write
|
||||
* @param tree Shared buffer for writing the tree. Will be grown as necessary.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_treebuilder_write_with_buffer(
|
||||
git_oid *oid, git_treebuilder *bld, git_buf *tree);
|
||||
|
||||
/** Callback for the tree traversal method */
|
||||
typedef int GIT_CALLBACK(git_treewalk_cb)(
|
||||
const char *root, const git_tree_entry *entry, void *payload);
|
||||
|
|
|
@ -96,12 +96,21 @@ typedef struct git_odb_stream git_odb_stream;
|
|||
/** A stream to write a packfile to the ODB */
|
||||
typedef struct git_odb_writepack git_odb_writepack;
|
||||
|
||||
/** a writer for multi-pack-index files. */
|
||||
typedef struct git_midx_writer git_midx_writer;
|
||||
|
||||
/** An open refs database handle. */
|
||||
typedef struct git_refdb git_refdb;
|
||||
|
||||
/** A custom backend for refs */
|
||||
typedef struct git_refdb_backend git_refdb_backend;
|
||||
|
||||
/** A git commit-graph */
|
||||
typedef struct git_commit_graph git_commit_graph;
|
||||
|
||||
/** a writer for commit-graph files. */
|
||||
typedef struct git_commit_graph_writer git_commit_graph_writer;
|
||||
|
||||
/**
|
||||
* Representation of an existing git repository,
|
||||
* including all its object contents
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
#ifndef INCLUDE_git_version_h__
|
||||
#define INCLUDE_git_version_h__
|
||||
|
||||
#define LIBGIT2_VERSION "1.1.1"
|
||||
#define LIBGIT2_VERSION "1.2.0"
|
||||
#define LIBGIT2_VER_MAJOR 1
|
||||
#define LIBGIT2_VER_MINOR 1
|
||||
#define LIBGIT2_VER_REVISION 1
|
||||
#define LIBGIT2_VER_MINOR 2
|
||||
#define LIBGIT2_VER_REVISION 0
|
||||
#define LIBGIT2_VER_PATCH 0
|
||||
|
||||
#define LIBGIT2_SOVERSION "1.1"
|
||||
#define LIBGIT2_SOVERSION "1.2"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -198,6 +198,7 @@ typedef enum {
|
|||
typedef struct git_worktree_prune_options {
|
||||
unsigned int version;
|
||||
|
||||
/** A combination of `git_worktree_prune_t` */
|
||||
uint32_t flags;
|
||||
} git_worktree_prune_options;
|
||||
|
||||
|
|
Binary file not shown.
BIN
libgit2/libgit2-1.2.0.so
Executable file
BIN
libgit2/libgit2-1.2.0.so
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue