Commit cf66c474 by Carlos Martín Nieto

examples: show the sideband progress on clone

This lets us see what the server (or libgit2 locally) is doing, rather
than having to stare at a non-moving screen.
parent c5c5cdb1
...@@ -46,6 +46,13 @@ static void print_progress(const progress_data *pd) ...@@ -46,6 +46,13 @@ static void print_progress(const progress_data *pd)
} }
} }
static int sideband_progress(const char *str, int len, void *payload)
{
printf("remote: %*s", len, str);
fflush(stdout);
return 0;
}
static int fetch_progress(const git_transfer_progress *stats, void *payload) static int fetch_progress(const git_transfer_progress *stats, void *payload)
{ {
progress_data *pd = (progress_data*)payload; progress_data *pd = (progress_data*)payload;
...@@ -86,6 +93,7 @@ int do_clone(git_repository *repo, int argc, char **argv) ...@@ -86,6 +93,7 @@ int do_clone(git_repository *repo, int argc, char **argv)
checkout_opts.progress_cb = checkout_progress; checkout_opts.progress_cb = checkout_progress;
checkout_opts.progress_payload = &pd; checkout_opts.progress_payload = &pd;
clone_opts.checkout_opts = checkout_opts; clone_opts.checkout_opts = checkout_opts;
clone_opts.fetch_opts.callbacks.sideband_progress = sideband_progress;
clone_opts.fetch_opts.callbacks.transfer_progress = &fetch_progress; clone_opts.fetch_opts.callbacks.transfer_progress = &fetch_progress;
clone_opts.fetch_opts.callbacks.credentials = cred_acquire_cb; clone_opts.fetch_opts.callbacks.credentials = cred_acquire_cb;
clone_opts.fetch_opts.callbacks.payload = &pd; clone_opts.fetch_opts.callbacks.payload = &pd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment