chore: upgrade to libgit2-1.2.0

This commit is contained in:
Aleksey Kulikov 2021-09-17 18:22:01 +03:00
parent b83fea9360
commit a1e420d86c
36 changed files with 2889 additions and 1024 deletions

View file

@ -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;