forked from p-ranav/cppgit2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrefspec.hpp
More file actions
61 lines (44 loc) · 1.6 KB
/
Copy pathrefspec.hpp
File metadata and controls
61 lines (44 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include <git2.h>
#include <cppgit2/connection_direction.hpp>
#include <cppgit2/data_buffer.hpp>
#include <cppgit2/libgit2_api.hpp>
#include <cppgit2/ownership.hpp>
#include <string>
namespace cppgit2 {
class refspec : public libgit2_api {
public:
// Default construct a refspec object
refspec();
// Construct from libgit2 C ptr
refspec(git_refspec* c_ptr, ownership owner = ownership::libgit2);
// Cleanup refspec object
~refspec();
// Get the refspec's direction.
connection_direction direction() const;
// Get the destination specifier
std::string destination() const;
// Check if a refspec's destination descriptor matches a reference
bool destination_matches_reference(const std::string& refname) const;
// Get the force update setting
bool is_force_update_enabled() const;
// Parse a given refspec string
static refspec parse(const std::string& input, bool is_fetch);
// Transform a target reference to its
// source reference following the refspec's rules
data_buffer transform_target_to_source_reference(const std::string& name);
// Get the source specifier
std::string source() const;
// Check if a refspec's source descriptor matches a reference
bool source_matches_reference(const std::string& refname) const;
// Get the refspec's string
std::string to_string() const;
// Transform a reference to its target following the refspec's rules
data_buffer transform_reference(const std::string& name);
// Access to libgit2 C ptr
const git_refspec* c_ptr() const;
private:
ownership owner_;
git_refspec* c_ptr_;
};
} // namespace cppgit2