diff --git a/src/api/helpers/git_helper.cpp b/src/api/helpers/git_helper.cpp index 22f97764..c57c3fe1 100644 --- a/src/api/helpers/git_helper.cpp +++ b/src/api/helpers/git_helper.cpp @@ -258,6 +258,7 @@ void GitHelper::Clone(const boost::filesystem::path& path, GrantWritePermissions(path); GrantWritePermissions(repoPath); + std::vector filenamesToMove; for (fs::directory_iterator it(repoPath); it != fs::directory_iterator(); ++it) { @@ -265,7 +266,11 @@ void GitHelper::Clone(const boost::filesystem::path& path, if (fs::exists(targetPath)) { fs::remove_all(targetPath); } - fs::rename(it->path(), targetPath); + filenamesToMove.push_back(it->path().filename()); + } + + for (const auto& filename : filenamesToMove) { + fs::rename(repoPath / filename, path / filename); } fs::remove_all(repoPath);