From 9e93d20d40ee1501b23c42b945dbf7e10420ac43 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Tue, 20 Aug 2024 17:46:20 +0200 Subject: GitRepo: Create commit from a directory explicitly... ...by writing its tree directly in the object database instead of working with the index. This allows the creation of trees that contain also entries with 'magic' names, such as the .git folder or .gitignore files. Callers must ensure the given directory only contains the needed entries. In particular, just-mr maps and serve service are updated to separate the import-to-Git repository path from the temporary path containing the content to be committed, to avoid polluting the content path with entries generated on repository initialization. --- src/buildtool/file_system/git_repo.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/buildtool/file_system/git_repo.hpp') diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp index 2aabf7ee..4d1be53f 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -152,8 +152,9 @@ class GitRepo { using anon_logger_ptr = std::shared_ptr; /// \brief Create tree from entries at given directory and commit it with - /// given message. Currently, the caller must guarantee that given path is - /// a subdirectory of the repository root path. + /// given message. The given path need not be a subdirectory of the + /// repository root path, but the caller must guarantee its entries are + /// readable. /// Only possible with real repository and thus non-thread-safe. /// \returns The commit hash, or nullopt if failure. It guarantees the /// logger is called exactly once with fatal if failure. -- cgit v1.2.3