File indexing completed on 2025-01-05 05:14:45

0001 /*
0002 SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
0003 
0004 SPDX-License-Identifier: GPL-3.0-or-later
0005 */
0006 
0007 #include "cloneobserver.h"
0008 
0009 namespace Git
0010 {
0011 
0012 namespace CloneCallbacks
0013 {
0014 
0015 int git_helper_checkout_notify_cb(git_checkout_notify_t why,
0016                                   const char *path,
0017                                   const git_diff_file *baseline,
0018                                   const git_diff_file *target,
0019                                   const git_diff_file *workdir,
0020                                   void *payload)
0021 {
0022     auto observer = reinterpret_cast<Git::CloneObserver *>(payload);
0023 
0024     return 0;
0025 }
0026 
0027 void git_helper_checkout_progress_cb(const char *path, size_t completed_steps, size_t total_steps, void *payload)
0028 {
0029     auto observer = reinterpret_cast<Git::CloneObserver *>(payload);
0030 
0031     if (!observer)
0032         return;
0033 
0034     // observer->setTotalObjects(stats->total_objects);
0035     // observer->setIndexedObjects(stats->indexed_objects);
0036     // observer->setReceivedObjects(stats->received_objects);
0037     // observer->setLocalObjects(stats->local_objects);
0038     // observer->setTotalDeltas(stats->total_deltas);
0039     // observer->setIndexedDeltas(stats->indexed_deltas);
0040     return;
0041 }
0042 
0043 void git_helper_checkout_perfdata_cb(const git_checkout_perfdata *perfdata, void *payload)
0044 {
0045     auto observer = reinterpret_cast<Git::CloneObserver *>(payload);
0046 }
0047 
0048 }
0049 
0050 CloneObserver::CloneObserver(QObject *parent)
0051     : FetchObserver{parent}
0052 {
0053 }
0054 
0055 void CloneObserver::init(git_checkout_options *opts)
0056 {
0057     opts->progress_payload = opts->perfdata_payload = opts->notify_payload = this;
0058     opts->progress_cb = &CloneCallbacks::git_helper_checkout_progress_cb;
0059     opts->notify_cb = &CloneCallbacks::git_helper_checkout_notify_cb;
0060     opts->perfdata_cb = &CloneCallbacks::git_helper_checkout_perfdata_cb;
0061 }
0062 }