@@ -81,7 +81,14 @@ error_code repository::recursive_scan_prologues(repository_flags flags)
8181 todo.insert (std::move (item));
8282 }
8383
84- auto hkdeps = _path / " _hkdeps" ;
84+ auto hkdeps_path = _path / " _hkdeps" ;
85+
86+ auto ec = std::error_code{};
87+ if (not std::filesystem::create_directory (hkdeps_path, ec) and ec) {
88+ std::println (stderr, " Error: could not create directory '{}': {}." , hkdeps_path.string (), ec.message ());
89+ std::terminate ();
90+ }
91+
8592 while (not todo.empty ()) {
8693 auto child_repo_url_node = todo.extract (todo.begin ());
8794 auto [it, inserted, _] = done.insert (std::move (child_repo_url_node));
@@ -90,11 +97,12 @@ error_code repository::recursive_scan_prologues(repository_flags flags)
9097 }
9198
9299 assert (it != done.end ());
93- auto child_repo_path = hkdeps / it->first .directory ();
100+ auto child_repo_path = hkdeps_path / it->first .directory ();
94101 auto &child_repo = get_child_repository (it->first );
95102 if (not child_repo.repository ) {
96103 if (auto r = git_checkout_or_clone (it->first , child_repo_path, flags); r != git_error::ok) {
97- return xxxxxxxxxxxxxxx needs destination directory in message it->second .add (error::could_not_clone_repository, it->first .url (), it->first .rev (), r).error ();
104+ auto short_hkdeps = std::format (" _hkdeps/{}" , it->first .directory ());
105+ return it->second .add (error::could_not_clone_repository, it->first .url (), it->first .rev (), short_hkdeps, r).error ();
98106 }
99107
100108 child_repo.repository = std::make_unique<repository>(child_repo_path);
@@ -105,9 +113,12 @@ error_code repository::recursive_scan_prologues(repository_flags flags)
105113 }
106114 }
107115
108- // Remove internal repositories not in done.
116+ // Remove internal repositories not in 'done'.
117+ std::erase_if (_child_repositories, [&](auto const & item) {
118+ return not done.contains (item.url );
119+ });
109120
110- return error_code{};
121+ return hk:: error_code{};
111122}
112123
113124void repository::untouch (bool remove)
0 commit comments