@@ -7,17 +7,17 @@ repository_wrapper::~repository_wrapper()
77 p_resource=nullptr ;
88}
99
10- repository_wrapper repository_wrapper::open (const std::string& directory)
10+ repository_wrapper repository_wrapper::open (std::string_view directory)
1111{
1212 repository_wrapper rw;
13- throwIfError (git_repository_open (&(rw.p_resource ), directory.c_str ()));
13+ throwIfError (git_repository_open (&(rw.p_resource ), directory.data ()));
1414 return rw;
1515}
1616
17- repository_wrapper repository_wrapper::init (const std::string& directory, bool bare)
17+ repository_wrapper repository_wrapper::init (std::string_view directory, bool bare)
1818{
1919 repository_wrapper rw;
20- throwIfError (git_repository_init (&(rw.p_resource ), directory.c_str (), bare));
20+ throwIfError (git_repository_init (&(rw.p_resource ), directory.data (), bare));
2121 return rw;
2222}
2323
@@ -34,22 +34,22 @@ index_wrapper repository_wrapper::make_index()
3434 return index;
3535}
3636
37- branch_wrapper repository_wrapper::create_branch (const std::string& name, bool force)
37+ branch_wrapper repository_wrapper::create_branch (std::string_view name, bool force)
3838{
3939 return create_branch (name, find_commit (), force);
4040}
4141
42- branch_wrapper repository_wrapper::create_branch (const std::string& name, const commit_wrapper& commit, bool force)
42+ branch_wrapper repository_wrapper::create_branch (std::string_view name, const commit_wrapper& commit, bool force)
4343{
4444 git_reference* branch = nullptr ;
45- throwIfError (git_branch_create (&branch, *this , name.c_str (), commit, force));
45+ throwIfError (git_branch_create (&branch, *this , name.data (), commit, force));
4646 return branch_wrapper (branch);
4747}
4848
49- branch_wrapper repository_wrapper::find_branch (const std::string& name)
49+ branch_wrapper repository_wrapper::find_branch (std::string_view name)
5050{
5151 git_reference* branch = nullptr ;
52- throwIfError (git_branch_lookup (&branch, *this , name.c_str (), GIT_BRANCH_LOCAL));
52+ throwIfError (git_branch_lookup (&branch, *this , name.data (), GIT_BRANCH_LOCAL));
5353 return branch_wrapper (branch);
5454}
5555
@@ -61,10 +61,10 @@ branch_iterator repository_wrapper::iterate_branches(git_branch_t type) const
6161}
6262
6363
64- commit_wrapper repository_wrapper::find_commit (const std::string& ref_name) const
64+ commit_wrapper repository_wrapper::find_commit (std::string_view ref_name) const
6565{
6666 git_oid oid_parent_commit;
67- throwIfError (git_reference_name_to_id (&oid_parent_commit, *this , ref_name.c_str ()));
67+ throwIfError (git_reference_name_to_id (&oid_parent_commit, *this , ref_name.data ()));
6868 return find_commit (oid_parent_commit);
6969}
7070
0 commit comments