File tree Expand file tree Collapse file tree 1 file changed +13
-15
lines changed
Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -22,24 +22,22 @@ void init_subcommand::run()
2222 std::filesystem::path target_dir = m_directory;
2323 bool reinit = std::filesystem::exists (target_dir / " .git" / " HEAD" );
2424
25- std::string path;
26- if (m_branch.empty ())
27- {
28- auto repo = repository_wrapper::init (m_directory, m_bare);
29- path = repo.path ();
30- }
31- else
32- {
33- git_repository_init_options opts = GIT_REPOSITORY_INIT_OPTIONS_INIT;
34- if (m_bare)
25+ repository_wrapper repo = [this ]() {
26+ if (m_branch.empty ())
3527 {
36- opts. flags |= GIT_REPOSITORY_INIT_BARE ;
28+ return repository_wrapper::init (m_directory, m_bare) ;
3729 }
38- opts.initial_head = m_branch.c_str ();
30+ else
31+ {
32+ git_repository_init_options opts = GIT_REPOSITORY_INIT_OPTIONS_INIT;
33+ if (m_bare) { opts.flags |= GIT_REPOSITORY_INIT_BARE; }
34+ opts.initial_head = m_branch.c_str ();
3935
40- auto repo = repository_wrapper::init_ext (m_directory, &opts);
41- path = repo.path ();
42- }
36+ return repository_wrapper::init_ext (m_directory, &opts);
37+ }
38+ }();
39+
40+ std::string path = repo.path ();
4341
4442 if (reinit)
4543 {
You can’t perform that action at this time.
0 commit comments