summaryrefslogtreecommitdiffstats
path: root/git-access.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-10 09:41:12 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-10 09:41:12 -0700
commitae1c4ef21e5b784cc84f8a7c04ec8873c1fe35b9 (patch)
treec915a8cdc1312472ad88887406c34455f40c2562 /git-access.c
parent865c4aedee37fe3e8a8fd0e9ef419891361a30fe (diff)
downloadsubsurface-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>
Diffstat (limited to 'git-access.c')
-rw-r--r--git-access.c10
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);