Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address review comments
  • Loading branch information
SandrineP committed Jul 17, 2025
commit 893eec9ec6bdb689c13f7f0343cb2bbde69b7cee
8 changes: 4 additions & 4 deletions src/subcommand/add_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ add_subcommand::add_subcommand(const libgit2_object&, CLI::App& app)
{
auto *sub = app.add_subcommand("add", "Add file contents to the index");

sub->add_option("files", add_files, "Files to add");
sub->add_option("files", m_add_files, "Files to add");

sub->add_flag("-A,--all,--no-ignore-removal", all_flag, "");
sub->add_flag("-A,--all,--no-ignore-removal", m_all_flag, "");
// sub->add_flag("-n,--dryrun", dryrun_flag, "");
// sub->add_flag("-u,--update", update_flag, "");
// sub->add_flag("-v,--verbose", verbose_flag, "");
Expand All @@ -28,12 +28,12 @@ void add_subcommand::run()

index_wrapper index = repo.make_index();

if (all_flag)
if (m_all_flag)
{
index.add_all();
}
else
{
index.add_entries(add_files);
index.add_entries(m_add_files);
}
}
4 changes: 2 additions & 2 deletions src/subcommand/add_subcommand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class add_subcommand
void run();

private:
bool all_flag = false;
std::vector<std::string> add_files;
bool m_all_flag = false;
std::vector<std::string> m_add_files;
};
6 changes: 3 additions & 3 deletions src/subcommand/init_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ init_subcommand::init_subcommand(const libgit2_object&, CLI::App& app)
{
auto *sub = app.add_subcommand("init", "Explanation of init here");

sub->add_flag("--bare", bare, "info about bare arg");
sub->add_flag("--bare", m_bare, "info about bare arg");

// If directory not specified, uses cwd.
sub->add_option("directory", directory, "info about directory arg")
sub->add_option("directory", m_directory, "info about directory arg")
->check(CLI::ExistingDirectory | CLI::NonexistentPath)
->default_val(get_current_git_path());

Expand All @@ -18,5 +18,5 @@ init_subcommand::init_subcommand(const libgit2_object&, CLI::App& app)

void init_subcommand::run()
{
repository_wrapper::init(directory, bare);
repository_wrapper::init(m_directory, m_bare);
}
4 changes: 2 additions & 2 deletions src/subcommand/init_subcommand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class init_subcommand
void run();

private:
bool bare;
std::string directory;
bool m_bare;
std::string m_directory;
};
12 changes: 6 additions & 6 deletions src/subcommand/status_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ status_subcommand::status_subcommand(const libgit2_object&, CLI::App& app)
{
auto *sub = app.add_subcommand("status", "Show modified files in working directory, staged for your next commit");

sub->add_flag("-s,--short", short_flag, "Give the output in the short-format.");
sub->add_flag("--long", long_flag, "Give the output in the long-format. This is the default.");
sub->add_flag("-s,--short", m_short_flag, "Give the output in the short-format.");
sub->add_flag("--long", m_long_flag, "Give the output in the long-format. This is the default.");
// sub->add_flag("--porcelain[=<version>]", porcelain, "Give the output in an easy-to-parse format for scripts.
// This is similar to the short output, but will remain stable across Git versions and regardless of user configuration.
// See below for details. The version parameter is used to specify the format version. This is optional and defaults
// to the original version v1 format.");
sub->add_flag("-b,--branch", branch_flag, "Show the branch and tracking info even in short-format.");
sub->add_flag("-b,--branch", m_branch_flag, "Show the branch and tracking info even in short-format.");

sub->callback([this]() { this->run(); });
};
Expand Down Expand Up @@ -194,11 +194,11 @@ void status_subcommand::run()
std::vector<std::string> ignored_to_print{};

output_format of = output_format::DEFAULT;
if (short_flag)
if (m_short_flag)
{
of = output_format::SHORT;
}
if (long_flag)
if (m_long_flag)
{
of = output_format::LONG;
}
Expand All @@ -215,7 +215,7 @@ void status_subcommand::run()
}
else
{
if (branch_flag)
if (m_branch_flag)
{
std::cout << "## " << branch_name << std::endl;
}
Expand Down
6 changes: 3 additions & 3 deletions src/subcommand/status_subcommand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class status_subcommand
void run();

private:
bool branch_flag = false;
bool long_flag = false;
bool short_flag = false;
bool m_branch_flag = false;
bool m_long_flag = false;
bool m_short_flag = false;
};
2 changes: 1 addition & 1 deletion src/wrapper/index_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void index_wrapper::add_all()

void index_wrapper::add_impl(std::vector<std::string> patterns)
{
git_strarray_wrapper array=git_strarray_wrapper(patterns);
git_strarray_wrapper array{patterns};
throwIfError(git_index_add_all(*this, array, 0, NULL, NULL));
throwIfError(git_index_write(*this));
}