forked from QuantStack/git2cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckout_subcommand.hpp
More file actions
52 lines (41 loc) · 1.12 KB
/
checkout_subcommand.hpp
File metadata and controls
52 lines (41 loc) · 1.12 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
#pragma once
#include <optional>
#include <string>
#include <CLI/CLI.hpp>
#include "../utils/common.hpp"
#include "../wrapper/repository_wrapper.hpp"
class checkout_subcommand
{
public:
explicit checkout_subcommand(const libgit2_object&, CLI::App& app);
void run();
private:
std::optional<annotated_commit_wrapper> resolve_local_ref
(
const repository_wrapper& repo,
const std::string& target_name
);
annotated_commit_wrapper create_local_branch
(
repository_wrapper& repo,
const std::string& target_name,
bool force
);
void checkout_tree
(
const repository_wrapper& repo,
const annotated_commit_wrapper& target_annotated_commit,
const std::string& target_name,
const git_checkout_options& options
);
void update_head
(
repository_wrapper& repo,
const annotated_commit_wrapper& target_annotated_commit,
const std::string& target_name
);
std::string m_branch_name = {};
bool m_create_flag = false;
bool m_force_create_flag = false;
bool m_force_checkout_flag = false;
};