This repository was archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathcherrypick.hpp
More file actions
56 lines (46 loc) · 1.63 KB
/
Copy pathcherrypick.hpp
File metadata and controls
56 lines (46 loc) · 1.63 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
#pragma once
#include <cppgit2/checkout.hpp>
#include <cppgit2/libgit2_api.hpp>
#include <cppgit2/merge.hpp>
#include <git2.h>
namespace cppgit2 {
class cherrypick : public libgit2_api {
public:
class options : public libgit2_api {
public:
options() : c_ptr_(nullptr) {
auto ret = git_cherrypick_init_options(&default_options_,
GIT_CHERRYPICK_OPTIONS_VERSION);
c_ptr_ = &default_options_;
if (ret != 0)
throw git_exception();
}
options(git_cherrypick_options *c_ptr) : c_ptr_(c_ptr) {}
// Version
unsigned int version() const { return c_ptr_->version; }
void set_version(unsigned int version) { c_ptr_->version = version; }
// Mainline
// For merge commits, the "mainline" is treated as the parent.
unsigned int mainline() const { return c_ptr_->mainline; }
void set_mainline(unsigned int mainline) { c_ptr_->mainline = mainline; }
// Checkout options
checkout::options checkout_options() const {
return checkout::options(&c_ptr_->checkout_opts);
}
void set_checkout_options(const checkout::options &checkout_options) {
c_ptr_->checkout_opts = *(checkout_options.c_ptr());
}
// Merge options
merge::options merge_options() const {
return merge::options(&c_ptr_->merge_opts);
}
void set_merge_options(const merge::options &merge_options) {
c_ptr_->merge_opts = *(merge_options.c_ptr());
}
const git_cherrypick_options *c_ptr() const { return c_ptr_; }
private:
git_cherrypick_options *c_ptr_;
git_cherrypick_options default_options_;
};
};
} // namespace cppgit2