[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/QuantStack/git2cpp/main/src/utils/progress.cpp [Back]  [Original]

#include "../utils/progress.hpp"

#include 
#include 
#include 

#include "../utils/common.hpp"

int sideband_progress(const char* str, int len, void*)
{
    printf("remote: %.*s", len, str);
    fflush(stdout);
    return 0;
}

int fetch_progress(const git_indexer_progress* stats, void* payload)
{
    static bool done = false;

    // We need to copy stats into payload even if the fetch is done,
    // because the checkout_progress callback will be called with the
    // same payload and needs the data to be up do date.
    auto* pr = reinterpret_cast(payload);
    *pr = *stats;

    if (done)
    {
        return 0;
    }

    int network_percent = pr->total_objects > 0 ? (100 * pr->received_objects / pr->total_objects) : 0;
    size_t kbytes = pr->received_bytes / 1024;
    size_t mbytes = kbytes / 1024;

    std::cout 

Web Proxy Viewer  |  New URL  |  Original Page