diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-13 16:34:12 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-23 14:18:48 +0100 |
commit | 8d9fd1818feee729e5adeab982608aff4eddd613 (patch) | |
tree | 0ba94d9db7d0c7933a3cd5d7246bc4d090b82540 /src/buildtool/file_system/git_utils.hpp | |
parent | ddb858a101e6da5d9e6f31c41777b7108e8952be (diff) | |
download | justbuild-8d9fd1818feee729e5adeab982608aff4eddd613.tar.gz |
GitRepo: Make repository initialisation more robust
As the initialisation of Git repositories is something that only
takes place once, we should check early and cheaply whether the
repository is already there before trying to initialize it.
If we do need to initilize a repo, we can afford more attempts and
longer wait times between tries to initalize if the failure to
initialize happens due to the internal Git locking mechanism.
Diffstat (limited to 'src/buildtool/file_system/git_utils.hpp')
-rw-r--r-- | src/buildtool/file_system/git_utils.hpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/buildtool/file_system/git_utils.hpp b/src/buildtool/file_system/git_utils.hpp index 68eb670b..5749c8b5 100644 --- a/src/buildtool/file_system/git_utils.hpp +++ b/src/buildtool/file_system/git_utils.hpp @@ -36,7 +36,10 @@ struct git_tree_entry; struct git_config; } -constexpr std::size_t kWaitTime{2}; // time in ms between tries for git locks +// time in ms between tries for git locks +constexpr std::size_t kGitLockWaitTime{100}; +// number of retries for git locks +constexpr std::size_t kGitLockNumTries{10}; [[nodiscard]] auto GitObjectID(std::string const& id, bool is_hex_id = false) noexcept |