From ae1c4ef21e5b784cc84f8a7c04ec8873c1fe35b9 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 10 Sep 2015 09:41:12 -0700 Subject: Cloud storage: add another progress callback This one sadly only appears to be called with 0% and 100% in my examples. Not sure what to do about that. Signed-off-by: Dirk Hohndel --- git-access.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/git-access.c b/git-access.c index aa919f96b..a9e411e65 100644 --- a/git-access.c +++ b/git-access.c @@ -81,6 +81,14 @@ static int transfer_progress_cb(const git_transfer_progress *stats, void *payloa return update_progress(percent); } +static int push_transfer_progress_cb(unsigned int current, unsigned int total, size_t bytes, void *payload) +{ + int percent = 0; + if (total != 0) + percent = 100 * current / total; + return update_progress(percent); +} + char *get_local_dir(const char *remote, const char *branch) { SHA_CTX ctx; @@ -195,7 +203,7 @@ int certificate_check_cb(git_cert *cert, int valid, const char *host, void *payl static int update_remote(git_repository *repo, git_remote *origin, git_reference *local, git_reference *remote, enum remote_transport rt) { git_push_options opts = GIT_PUSH_OPTIONS_INIT; - opts.callbacks.transfer_progress = &transfer_progress_cb; + opts.callbacks.push_transfer_progress = &push_transfer_progress_cb; git_strarray refspec; const char *name = git_reference_name(local); -- cgit v1.2.3-70-g09d2