diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-09-10 09:41:12 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-10 09:41:12 -0700 |
commit | ae1c4ef21e5b784cc84f8a7c04ec8873c1fe35b9 (patch) | |
tree | c915a8cdc1312472ad88887406c34455f40c2562 | |
parent | 865c4aedee37fe3e8a8fd0e9ef419891361a30fe (diff) | |
download | subsurface-ae1c4ef21e5b784cc84f8a7c04ec8873c1fe35b9.tar.gz |
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 <dirk@hohndel.org>
-rw-r--r-- | git-access.c | 10 |
1 files changed, 9 insertions, 1 deletions
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); |