Skip to content

Commit 3cd3904

Browse files
authored
clean strings (#54)
1 parent 437e2b7 commit 3cd3904

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/subcommand/checkout_subcommand.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void checkout_subcommand::run()
5959
annotated_commit_wrapper checkout_subcommand::create_local_branch
6060
(
6161
repository_wrapper& repo,
62-
const std::string& target_name,
62+
const std::string_view target_name,
6363
bool force
6464
)
6565
{
@@ -71,7 +71,7 @@ void checkout_subcommand::checkout_tree
7171
(
7272
const repository_wrapper& repo,
7373
const annotated_commit_wrapper& target_annotated_commit,
74-
const std::string& target_name,
74+
const std::string_view target_name,
7575
const git_checkout_options& options
7676
)
7777
{
@@ -83,7 +83,7 @@ void checkout_subcommand::update_head
8383
(
8484
repository_wrapper& repo,
8585
const annotated_commit_wrapper& target_annotated_commit,
86-
const std::string& target_name
86+
const std::string_view target_name
8787
)
8888
{
8989
std::string_view annotated_ref = target_annotated_commit.reference_name();

src/subcommand/checkout_subcommand.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ class checkout_subcommand
2020
annotated_commit_wrapper create_local_branch
2121
(
2222
repository_wrapper& repo,
23-
const std::string& target_name,
23+
const std::string_view target_name,
2424
bool force
2525
);
2626

2727
void checkout_tree
2828
(
2929
const repository_wrapper& repo,
3030
const annotated_commit_wrapper& target_annotated_commit,
31-
const std::string& target_name,
31+
const std::string_view target_name,
3232
const git_checkout_options& options
3333
);
3434

3535
void update_head
3636
(
3737
repository_wrapper& repo,
3838
const annotated_commit_wrapper& target_annotated_commit,
39-
const std::string& target_name
39+
const std::string_view target_name
4040
);
4141

4242
std::string m_branch_name = {};

src/utils/git_exception.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void throw_if_error(int exit_code)
1111
}
1212

1313

14-
git_exception::git_exception(const std::string& message, int error_code)
14+
git_exception::git_exception(const std::string_view message, int error_code)
1515
: m_message(message), m_error_code(error_code)
1616
{}
1717

src/utils/git_exception.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ void throw_if_error(int exit_code);
88
class git_exception : public std::exception
99
{
1010
public:
11-
git_exception(const std::string& message, int error_code);
11+
12+
git_exception(const std::string_view message, int error_code);
1213

1314
int error_code() const;
1415

1516
const char* what() const noexcept override;
1617

1718
private:
19+
1820
std::string m_message;
1921
int m_error_code;
2022
};

0 commit comments

Comments
 (0)