From 7a06a54a149e09e9e442a6dd0a2799ceeb2a843c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= Date: Sat, 21 Dec 2019 11:39:33 +0100 Subject: [PATCH] Move to libgit2 master --- .travis.sh | 3 ++- appveyor.yml | 2 +- pygit2/__init__.py | 2 +- pygit2/_run.py | 1 + pygit2/decl/clone.h | 2 +- pygit2/decl/indexer.h | 11 +++++++++++ pygit2/decl/remote.h | 16 +++++++++------- pygit2/decl/types.h | 12 ------------ pygit2/remote.py | 2 +- src/worktree.c | 2 +- 10 files changed, 28 insertions(+), 25 deletions(-) create mode 100644 pygit2/decl/indexer.h diff --git a/.travis.sh b/.travis.sh index 4abc978ad..b539cc00b 100755 --- a/.travis.sh +++ b/.travis.sh @@ -9,7 +9,8 @@ fi cd ~ -git clone --depth=1 -b "maint/v${LIBGIT2_VERSION}" https://github.com/libgit2/libgit2.git +#git clone --depth=1 -b "maint/v${LIBGIT2_VERSION}" https://github.com/libgit2/libgit2.git +git clone --depth=1 -b master https://github.com/libgit2/libgit2.git cd libgit2/ mkdir build && cd build diff --git a/appveyor.yml b/appveyor.yml index 0c77280ec..e0676ee46 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,7 +36,7 @@ build_script: # Clone, build and install libgit2 - cmd: | set LIBGIT2=%APPVEYOR_BUILD_FOLDER%\venv - git clone --depth=1 -b maint/v0.28 https://github.com/libgit2/libgit2.git libgit2 + git clone --depth=1 -b master https://github.com/libgit2/libgit2.git libgit2 cd libgit2 cmake . -DBUILD_CLAR=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%LIBGIT2%" -G "%GENERATOR%" cmake --build . --target install diff --git a/pygit2/__init__.py b/pygit2/__init__.py index 0c6920d53..9fcda66ff 100644 --- a/pygit2/__init__.py +++ b/pygit2/__init__.py @@ -229,7 +229,7 @@ def clone_repository( d_handle = ffi.new_handle(d) # Perform the initialization with the version we compiled - C.git_clone_init_options(opts, C.GIT_CLONE_OPTIONS_VERSION) + C.git_clone_options_init(opts, C.GIT_CLONE_OPTIONS_VERSION) # We need to keep the ref alive ourselves checkout_branch_ref = None diff --git a/pygit2/_run.py b/pygit2/_run.py index ebdd9a3ca..2956ed133 100644 --- a/pygit2/_run.py +++ b/pygit2/_run.py @@ -64,6 +64,7 @@ 'pack.h', 'transport.h', 'proxy.h', + 'indexer.h', 'remote.h', 'clone.h', 'common.h', diff --git a/pygit2/decl/clone.h b/pygit2/decl/clone.h index 2be115327..87a0302d7 100644 --- a/pygit2/decl/clone.h +++ b/pygit2/decl/clone.h @@ -33,7 +33,7 @@ typedef struct git_clone_options { void *remote_cb_payload; } git_clone_options; -int git_clone_init_options( +int git_clone_options_init( git_clone_options *opts, unsigned int version); diff --git a/pygit2/decl/indexer.h b/pygit2/decl/indexer.h new file mode 100644 index 000000000..86769196b --- /dev/null +++ b/pygit2/decl/indexer.h @@ -0,0 +1,11 @@ +typedef struct git_indexer_progress { + unsigned int total_objects; + unsigned int indexed_objects; + unsigned int received_objects; + unsigned int local_objects; + unsigned int total_deltas; + unsigned int indexed_deltas; + size_t received_bytes; +} git_indexer_progress; + +typedef int (*git_indexer_progress_cb)(const git_indexer_progress *stats, void *payload); diff --git a/pygit2/decl/remote.h b/pygit2/decl/remote.h index c43f6f7c1..a5b705650 100644 --- a/pygit2/decl/remote.h +++ b/pygit2/decl/remote.h @@ -2,13 +2,13 @@ #define GIT_PUSH_OPTIONS_VERSION ... #define GIT_REMOTE_CALLBACKS_VERSION ... -typedef enum git_remote_completion_type { +typedef enum git_remote_completion_t { GIT_REMOTE_COMPLETION_DOWNLOAD, GIT_REMOTE_COMPLETION_INDEXING, GIT_REMOTE_COMPLETION_ERROR, -} git_remote_completion_type; +} git_remote_completion_t; -typedef int (*git_push_transfer_progress)( +typedef int (*git_push_transfer_progress_cb)( unsigned int current, unsigned int total, size_t bytes, @@ -23,21 +23,23 @@ typedef struct { typedef int (*git_push_negotiation)(const git_push_update **updates, size_t len, void *payload); typedef int (*git_push_update_reference_cb)(const char *refname, const char *status, void *data); +typedef int (*git_url_resolve_cb)(git_buf *url_resolved, const char *url, int direction, void *payload); struct git_remote_callbacks { unsigned int version; git_transport_message_cb sideband_progress; - int (*completion)(git_remote_completion_type type, void *data); + int (*completion)(git_remote_completion_t type, void *data); git_cred_acquire_cb credentials; git_transport_certificate_check_cb certificate_check; - git_transfer_progress_cb transfer_progress; + git_indexer_progress_cb transfer_progress; int (*update_tips)(const char *refname, const git_oid *a, const git_oid *b, void *data); git_packbuilder_progress pack_progress; - git_push_transfer_progress push_transfer_progress; + git_push_transfer_progress_cb push_transfer_progress; git_push_update_reference_cb push_update_reference; git_push_negotiation push_negotiation; git_transport_cb transport; void *payload; + git_url_resolve_cb resolve_url; }; typedef struct { @@ -112,7 +114,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks); int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_push_options *opts); -const git_transfer_progress * git_remote_stats(git_remote *remote); +const git_indexer_progress * git_remote_stats(git_remote *remote); int git_remote_add_push(git_repository *repo, const char *remote, const char *refspec); int git_remote_add_fetch(git_repository *repo, const char *remote, const char *refspec); int git_remote_init_callbacks( diff --git a/pygit2/decl/types.h b/pygit2/decl/types.h index a9fcd66db..2a6cadd8a 100644 --- a/pygit2/decl/types.h +++ b/pygit2/decl/types.h @@ -33,17 +33,6 @@ typedef struct git_signature { git_time when; } git_signature; -typedef struct git_transfer_progress { - unsigned int total_objects; - unsigned int indexed_objects; - unsigned int received_objects; - unsigned int local_objects; - unsigned int total_deltas; - unsigned int indexed_deltas; - size_t received_bytes; -} git_transfer_progress; - - typedef enum git_cert_t { GIT_CERT_NONE, GIT_CERT_X509, @@ -56,7 +45,6 @@ typedef struct { } git_cert; typedef int (*git_transport_message_cb)(const char *str, int len, void *payload); -typedef int (*git_transfer_progress_cb)(const git_transfer_progress *stats, void *payload); typedef int (*git_transport_certificate_check_cb)(git_cert *cert, int valid, const char *host, void *payload); typedef enum { diff --git a/pygit2/remote.py b/pygit2/remote.py index 4c9c97376..e4a569c0f 100644 --- a/pygit2/remote.py +++ b/pygit2/remote.py @@ -220,7 +220,7 @@ def _fill_connect_callbacks(self, connect_callbacks): # These functions exist to be called by the git_remote as # callbacks. They proxy the call to whatever the user set - @ffi.callback('git_transfer_progress_cb') + @ffi.callback('git_indexer_progress_cb') def _transfer_progress_cb(stats_ptr, data): self = ffi.from_handle(data) diff --git a/src/worktree.c b/src/worktree.c index b163367c7..3507139e3 100644 --- a/src/worktree.c +++ b/src/worktree.c @@ -71,7 +71,7 @@ Worktree_prune(Worktree *self, PyObject *args) if (!PyArg_ParseTuple(args, "|i", &force)) return NULL; - git_worktree_prune_init_options(&prune_opts, GIT_WORKTREE_PRUNE_OPTIONS_VERSION); + git_worktree_prune_options_init(&prune_opts, GIT_WORKTREE_PRUNE_OPTIONS_VERSION); prune_opts.flags = force & (GIT_WORKTREE_PRUNE_VALID | GIT_WORKTREE_PRUNE_LOCKED); err = git_worktree_prune(self->worktree, &prune_opts);