summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_cas.cpp
AgeCommit message (Collapse)Author
2025-06-05GitCAS: Reduce log level where fatal not expectedPaul Cristian Sarbu
...and fix inconsistent capitalisation.
2025-06-05GitCAS: Ensure compliance with existing noexcept specifiersPaul Cristian Sarbu
Do not implicitly trust that the third-party code called in these methods is non-throwing and instead properly handle any exception that might arise.
2025-06-04git_cas read object: allow validation of individual blobsPaul Cristian Sarbu
This allows individual blobs read to be checked, e.g., for upwards symlinks, also when not part of a tree, which performs such a validation for its entries during its parsing into a GitTree.
2025-01-22Git CAS access: reduce log levelKlaus Aehlig
Trying to access a git object return a recoverable failure, hence the failure to find the object in the git object database should be logged at warning level at most. Moreover, in some cases we should log that event at an even lower level, e.g., if we're just checking the presence of the object in the local git cas to avoid unnecessary network access.
2024-12-11GitCAS::Open: allow specifying the log-level for failureKlaus Aehlig
This method returns a GitCASPtr allowing the caller to handle failure gracefully. Therefore, logging should be at most at level Warning as it is up to the caller to provide the fatal error message. Moreover, it can be at lower level in cases where failure to open that git cas is not an unexpected event, e.g., when looking for a blob in local mirrors first.
2024-12-05GitCAS: remove mutex and locksMaksim Denisov
...since there are no unique_locks any more.
2024-12-05GitCAS: retain git_repository alive.Maksim Denisov
2024-12-05GitCAS: implement method for creation of an empty GitCASMaksim Denisov
...and use it in GitRepo to set custom backends.
2024-12-05GitCAS: remove redundant methodMaksim Denisov
2024-12-05GitCAS: avoid manual memory managementMaksim Denisov
...and fix a potential memory leak in the try-catch for std::filesystem::absolute.
2024-12-05GitCAS: use the same call for openning repository as GitRepo does.Maksim Denisov
2024-11-14file_system: Implement IWYU suggestionsPaul Cristian Sarbu
2024-03-15Clean up more includes and targetsPaul Cristian Sarbu
Some of the more specific issues addressed: - missing log_level target/include - header-only libs wrongly marking deps as private - missing/misplaced gsl includes
2023-07-10just-mr: Fix handling of .gitignore files in git repositoriesPaul Cristian Sarbu
The command 'git add .' does not include paths found in .gitignore files in the directory tree where the command is issued. This is not the desired behaviour, as we expect for a tree with a given commit id to contain all of the entries, irrespective of their meaning to Git. This commit addresses the issue as described. For the just-mr.py script we modified the staging command to 'git add -f .'. For the compiled just-mr, simply adding the force flag to 'git_index_add_all' did not work as intended for files found in ignored subdirectories. This is a known libgit2 issue which has been fixed in v1.6.3. Until we can upgrade our libgit2 version, a workaround was implemented: we recursively read the directory entries ourselves and add each of them iteratively using 'git_index_add_bypath', making sure to ignore the root '.git' subtree (which cannot be staged). At the moment the handling of Git submodules remains an open issue, as Git does not allow '.git' subtrees to be forcefully added to the index, and thus such directory entries will currently not be considered as part of a git tree. This however is consistent behavior between Git and libgit2.
2023-06-09Git CAS: report absence of CAS at debug levelKlaus Aehlig
A git CAS ist just a fall back, so it is OK if it is absent (e.g., the specificed directory does not exist). Therefore only log at debug level, not at error level if we cannot open it.
2023-06-05git cas: only compute absolute path if not absolute alreadyKlaus Aehlig
... and in this way, continue to work correctly in the absence of a current working directory.
2023-05-15memcheck: fix race in libgit2...Paul Cristian Sarbu
...caused by incorrectly setting and resetting the library internal state and the misuse of pthreads in libgit2. Normally, git_libgit2_init and git_libgit2_shutdown should span the life of a worker thread in order to be safely used. However, due to an incorrect implementation of libgit2's threadstate with pthreads, on unix systems there is a race condition. Until the use of pthread_key_t is corrected in libgit2, we need to apply a workaround by always ensuring that the main thread is the first thread reaching the GitContext constructor.
2023-04-26imports: Switch to Microsoft GSL implementationOliver Reiche
... with two minor code base changes compared to previous use of gsl-lite: - dag.hpp: ActionNode::Ptr and ArtifactNode::Ptr are not wrapped in gsl::not_null<> anymore, due to lack of support for wrapping std::unique_ptr<>. More specifically, the move constructor is missing, rendering it impossible to use std::vector<>::emplace_back(). - utils/cpp/gsl.hpp: New header file added to implement the macros ExpectsAudit() and EnsureAudit(), asserts running only in debug builds, which were available in gsl-lite but are missing in MS GSL.
2023-03-30GitRepo: Guard fake repository odb wrappingPaul Cristian Sarbu
In the current libgit2 implementation, a fake repository wrapped around an existing odb is being registered as owner the same way as a normal repository object. Therefore, one has to guard both the creation and destruction of the fake repository against all other git operations that might access the internal cache during this transfer of ownership.
2023-02-17structure cleanup: move remote operations of GitRepo to other_tools...Paul Cristian Sarbu
...in order to not include unwanted dependencies in just proper. The new class extends the GitRepo class used for just's Git tree operations and gets used in all of just-mr's async maps.
2022-12-21Git: Wrap libgit2 raw pointersPaul Cristian Sarbu
2022-12-21Git CAS: Move Git tree ops to fake repo wrapper classPaul Cristian Sarbu
2022-12-20Git CAS: Add fake repository wrapper for git odbPaul Cristian Sarbu
2022-12-20Git CAS: Clean includesPaul Cristian Sarbu
Removed unused file_system_manager dependency
2022-12-20Git CAS: Add a Git context class to maintain the libgit2 statePaul Cristian Sarbu
2022-10-26GitCAS: Disable code that is unused during bootstrapOliver Reiche
2022-10-12Add copyright and license notice to all source and header filesKlaus Aehlig
Signed-off-by: Goetz Brasche <goetz.brasche@huawei.com>
2022-09-13Fix build with gcc/g++Oliver Reiche
2022-08-05GitCAS: Support reading/creating trees without filesystem IOOliver Reiche
2022-08-05GitCAS: Add create tree via libgit2's treebuilderOliver Reiche
2022-08-05GitCAS: Implement reading git tree via libgit2Oliver Reiche
2022-04-27Remove libggit2 as host bootstrap dependencyKlaus Aehlig
Since in default (bundled) bootstrap, we bring our own version of libgit2, also use that for the initial bootstrap step.
2022-03-23Apply changes suggested by clang-tidy 11Oliver Reiche
2022-02-22Initial self-hosting commitKlaus Aehlig
This is the initial version of our tool that is able to build itself. In can be bootstrapped by ./bin/bootstrap.py Co-authored-by: Oliver Reiche <oliver.reiche@huawei.com> Co-authored-by: Victor Moreno <victor.moreno1@huawei.com>