SlHelpers
FetchCallbacks.h
1 // SPDX-License-Identifier: GPL-2.0-only
2 
3 #pragma once
4 
5 #include <optional>
6 #include <string_view>
7 
8 #include <git2.h>
9 
10 namespace SlGit {
11 
18 public:
21 
28  virtual void checkoutProgress([[maybe_unused]] std::string_view path,
29  [[maybe_unused]] size_t completedSteps,
30  [[maybe_unused]] size_t totalSteps) {}
31 
40  virtual int credentials([[maybe_unused]] git_credential **cred,
41  [[maybe_unused]] std::string_view url,
42  [[maybe_unused]] std::optional<std::string_view> usernameFromUrl,
43  [[maybe_unused]] unsigned int allowedTypes) {
44  return GIT_PASSTHROUGH;
45  }
53  virtual int packProgress([[maybe_unused]] int stage, [[maybe_unused]] uint32_t current,
54  [[maybe_unused]] uint32_t total) {
55  return GIT_PASSTHROUGH;
56  }
62  virtual int sidebandProgress([[maybe_unused]] std::string_view str) {
63  return GIT_PASSTHROUGH;
64  }
70  virtual int transferProgress([[maybe_unused]] const git_indexer_progress &stats) {
71  return GIT_PASSTHROUGH;
72  }
81  virtual int updateRefs([[maybe_unused]] std::string_view refname,
82  [[maybe_unused]] const git_oid &a,
83  [[maybe_unused]] const git_oid &b,
84  [[maybe_unused]] git_refspec &ref) {
85  return GIT_PASSTHROUGH;
86  }
87 };
88 
89 }
Definition: Blob.h:11
virtual int packProgress([[maybe_unused]] int stage, [[maybe_unused]] uint32_t current, [[maybe_unused]] uint32_t total)
Called many times when packing objects.
Definition: FetchCallbacks.h:53
FetchCallbacks()
Construct FetchCallbacks.
Definition: FetchCallbacks.h:20
virtual void checkoutProgress([[maybe_unused]] std::string_view path, [[maybe_unused]] size_t completedSteps, [[maybe_unused]] size_t totalSteps)
Called for each path in the tree.
Definition: FetchCallbacks.h:28
virtual int sidebandProgress([[maybe_unused]] std::string_view str)
Callback for messages received by the transport.
Definition: FetchCallbacks.h:62
virtual int updateRefs([[maybe_unused]] std::string_view refname, [[maybe_unused]] const git_oid &a, [[maybe_unused]] const git_oid &b, [[maybe_unused]] git_refspec &ref)
Called for each updated reference.
Definition: FetchCallbacks.h:81
Callbacks invoked from Repo::clone() or Remote::fetchRefspecs()
Definition: FetchCallbacks.h:17
virtual int credentials([[maybe_unused]] git_credential **cred, [[maybe_unused]] std::string_view url, [[maybe_unused]] std::optional< std::string_view > usernameFromUrl, [[maybe_unused]] unsigned int allowedTypes)
Fill in credentials.
Definition: FetchCallbacks.h:40
virtual int transferProgress([[maybe_unused]] const git_indexer_progress &stats)
Called many times during download and indexing.
Definition: FetchCallbacks.h:70