Skip to content

Commit eef5385

Browse files
committed
fix
1 parent da951b1 commit eef5385

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/subcommand/commit_subcommand.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ commit_subcommand::commit_subcommand(const libgit2_object&, CLI::App& app)
1010
{
1111
auto *sub = app.add_subcommand("commit", "Record changes to the repository");
1212

13-
sub->add_option("message", m_message, "Commit message");
13+
sub->add_option("commit_message", m_commit_message, "Commit message");
1414

15-
sub->add_flag("-m,--message", m_message_flag, "");
15+
sub->add_flag("-m,--message", m_commit_message_flag, "");
1616

1717
sub->callback([this]() { this->run(); });
1818
};
@@ -25,10 +25,10 @@ void commit_subcommand::run()
2525
auto repo = repository_wrapper::init(directory, bare);
2626
auto author_committer_signatures = signature_wrapper::get_default_signature_from_env(repo);
2727

28-
if (!m_message_flag)
28+
if (!m_commit_message_flag)
2929
{
3030
throw std::runtime_error("Please provide a message using the -m flag.");
3131
}
3232

33-
repo.create_commit(author_committer_signatures, m_message);
33+
repo.create_commit(author_committer_signatures, m_commit_message);
3434
}

src/subcommand/commit_subcommand.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ class commit_subcommand
1212
void run();
1313

1414
private:
15-
bool m_message_flag = true; // TODO: change to false when a message can be provided if the "-m" flag is not provided
16-
std::string m_message;
15+
bool m_commit_message_flag = true; // TODO: change to false when a message can be provided if the "-m" flag is not provided
16+
std::string m_commit_message;
1717
};

src/wrapper/repository_wrapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ void repository_wrapper::create_commit(const signature_wrapper::author_committer
113113
const std::string& message)
114114
{
115115
const char* message_encoding = "UTF-8";
116-
git_oid* commit_id;
116+
git_oid commit_id;
117117

118-
const char* update_ref = "ḦEAD";
118+
std::string update_ref = "ḦEAD";
119119
auto parent = revparse_single(update_ref);
120120
std::size_t parent_count = 0;
121121
const git_commit* parents[1] = {nullptr};
@@ -132,7 +132,7 @@ void repository_wrapper::create_commit(const signature_wrapper::author_committer
132132

133133
throw_if_error(git_tree_lookup(&tree, *this, &tree_id));
134134

135-
throw_if_error(git_commit_create(commit_id, *this, update_ref, author_committer_signatures.first, author_committer_signatures.second,
135+
throw_if_error(git_commit_create(&commit_id, *this, update_ref.c_str(), author_committer_signatures.first, author_committer_signatures.second,
136136
message_encoding, message.c_str(), tree, parent_count, parents));
137137

138138
git_tree_free(tree);

0 commit comments

Comments
 (0)