diff options
author | yuangli <yuangli@mathworks.com> | 2022-07-29 13:19:33 +0100 |
---|---|---|
committer | yuangli <yuangli@mathworks.com> | 2022-07-29 13:19:33 +0100 |
commit | 68bbcefd35a8b3a864e9ed7598b19fefc5f74055 (patch) | |
tree | eff903d5071fb79348e70fa62a9fcdb745b47938 /include/git2 | |
parent | a491917f8e37108b6180590736d833095626b1ec (diff) | |
parent | f19ffc8a6d88432146a87cd3fb2ca21528478be4 (diff) | |
download | libgit2-68bbcefd35a8b3a864e9ed7598b19fefc5f74055.tar.gz |
Merge branch 'transportPR' into shallow-clone-network
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/remote.h | 7 | ||||
-rw-r--r-- | include/git2/repository.h | 11 | ||||
-rw-r--r-- | include/git2/sys/transport.h | 26 |
3 files changed, 41 insertions, 3 deletions
diff --git a/include/git2/remote.h b/include/git2/remote.h index 8c9c26f3f..871d898e5 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -754,11 +754,16 @@ typedef struct { * Extra headers for this fetch operation */ git_strarray custom_headers; + + /** + * Depth of the fetch to perform + */ + int depth; } git_fetch_options; #define GIT_FETCH_OPTIONS_VERSION 1 #define GIT_FETCH_OPTIONS_INIT { GIT_FETCH_OPTIONS_VERSION, GIT_REMOTE_CALLBACKS_INIT, GIT_FETCH_PRUNE_UNSPECIFIED, 1, \ - GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, GIT_PROXY_OPTIONS_INIT } + GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, GIT_PROXY_OPTIONS_INIT, { NULL }, -1 } /** * Initialize git_fetch_options structure diff --git a/include/git2/repository.h b/include/git2/repository.h index c87f3c962..24a94118b 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -923,6 +923,17 @@ GIT_EXTERN(const char *) git_repository_get_namespace(git_repository *repo); GIT_EXTERN(int) git_repository_is_shallow(git_repository *repo); /** + * Determine the shallow roots of the repository + * + * This oidarray is owned by the library. Do not free it. + * + * @param out An array of shallow oids. + * @param repo The repository + * @return 0 on success, an error otherwise. + */ +GIT_EXTERN(int) git_repository_shallow_roots(git_oidarray *out, git_repository *repo); + +/** * Retrieve the configured identity to use for reflogs * * The memory is owned by the repository and must not be freed by the diff --git a/include/git2/sys/transport.h b/include/git2/sys/transport.h index 06ae7079f..391765b77 100644 --- a/include/git2/sys/transport.h +++ b/include/git2/sys/transport.h @@ -25,6 +25,24 @@ GIT_BEGIN_DECL +/** + * Flags to pass to transport + * + * Currently unused. + */ +typedef enum { + GIT_TRANSPORTFLAGS_NONE = 0, +} git_transport_flags_t; + +typedef struct git_shallowarray git_shallowarray; + +typedef struct { + const git_remote_head * const *refs; + size_t count; + git_shallowarray *shallow_roots; + int depth; +} git_fetch_negotiation; + struct git_transport { unsigned int version; /**< The struct version */ @@ -84,8 +102,7 @@ struct git_transport { int GIT_CALLBACK(negotiate_fetch)( git_transport *transport, git_repository *repo, - const git_remote_head * const *refs, - size_t count); + const git_fetch_negotiation *fetch_data); /** * Start downloading the packfile from the remote repository. @@ -430,6 +447,11 @@ GIT_EXTERN(int) git_smart_subtransport_ssh( git_transport *owner, void *param); +GIT_EXTERN(size_t) git_shallowarray_count(git_shallowarray *array); +GIT_EXTERN(const git_oid *) git_shallowarray_get(git_shallowarray *array, size_t idx); +GIT_EXTERN(int) git_shallowarray_add(git_shallowarray *array, git_oid *oid); +GIT_EXTERN(int) git_shallowarray_remove(git_shallowarray *array, git_oid *oid); + /** @} */ GIT_END_DECL #endif |