SlHelpers
Toggle main menu visibility
Loading...
Searching...
No Matches
DefaultFetchCallbacks.h
1
// SPDX-License-Identifier: GPL-2.0-only
2
3
#pragma once
4
5
#include "../helpers/Ratelimit.h"
6
#include "../helpers/SSH.h"
7
8
#include "FetchCallbacks.h"
9
10
namespace
SlGit {
11
15
class
DefaultFetchCallbacks
:
public
FetchCallbacks
{
16
public
:
18
DefaultFetchCallbacks
() : ratelimit(std::chrono::seconds(2)), tried(0), triedKey(0),
19
grabbedKeys(false) { }
20
21
virtual
void
checkoutProgress
(std::string_view path,
size_t
completedSteps,
22
size_t
totalSteps)
override
;
23
24
virtual
int
credentials
(git_credential **out, std::string_view url,
25
std::optional<std::string_view> usernameFromUrl,
26
unsigned
int
allowedTypes)
override
;
27
virtual
int
packProgress
(
int
stage, uint32_t current, uint32_t total)
override
;
28
virtual
int
sidebandProgress
(std::string_view str)
override
;
29
virtual
int
transferProgress
(
const
git_indexer_progress &stats)
override
;
30
virtual
int
updateRefs
(std::string_view refname,
const
git_oid &a,
const
git_oid &b,
31
git_refspec &)
override
;
32
33
private
:
34
void
getUserName(std::optional<std::string_view> usernameFromUrl);
35
std::string_view extractHost(std::string_view url);
36
void
getKeys(std::string_view url);
37
38
std::string userName;
39
SlHelpers::Ratelimit
ratelimit;
40
SlSSH::Keys::KeyPairs
keys;
41
unsigned
int
tried;
42
unsigned
int
triedKey;
43
bool
grabbedKeys;
44
};
45
46
}
SlGit::DefaultFetchCallbacks::sidebandProgress
virtual int sidebandProgress(std::string_view str) override
Callback for messages received by the transport.
SlGit::DefaultFetchCallbacks::checkoutProgress
virtual void checkoutProgress(std::string_view path, size_t completedSteps, size_t totalSteps) override
Called for each path in the tree.
SlGit::DefaultFetchCallbacks::DefaultFetchCallbacks
DefaultFetchCallbacks()
Construct DefaultFetchCallbacks.
Definition
DefaultFetchCallbacks.h:18
SlGit::DefaultFetchCallbacks::updateRefs
virtual int updateRefs(std::string_view refname, const git_oid &a, const git_oid &b, git_refspec &) override
Called for each updated reference.
SlGit::DefaultFetchCallbacks::packProgress
virtual int packProgress(int stage, uint32_t current, uint32_t total) override
Called many times when packing objects.
SlGit::DefaultFetchCallbacks::transferProgress
virtual int transferProgress(const git_indexer_progress &stats) override
Called many times during download and indexing.
SlGit::DefaultFetchCallbacks::credentials
virtual int credentials(git_credential **out, std::string_view url, std::optional< std::string_view > usernameFromUrl, unsigned int allowedTypes) override
Fill in credentials.
SlGit::FetchCallbacks::FetchCallbacks
FetchCallbacks()
Construct FetchCallbacks.
Definition
FetchCallbacks.h:20
SlHelpers::Ratelimit
Rate-limit some actions.
Definition
Ratelimit.h:12
SlSSH::Keys::KeyPairs
std::vector< KeyPair > KeyPairs
A list of key pairs.
Definition
SSH.h:24
include
git
DefaultFetchCallbacks.h
Generated by
1.17.0