|
KiCad PCB EDA Suite
|
Retrying short git writes that lost a race with another process. More...
#include <import_export.h>#include <chrono>#include <filesystem>#include <functional>#include <memory>#include <string>Go to the source code of this file.
Classes | |
| class | KIGIT::REPO_ACTION_LOCK |
| A process's lock on $GIT_COMMON_DIR/kicad-action, held while it rewrites the files, the index or HEAD in more than one step, so no other process sees a branch switch half done. More... | |
Namespaces | |
| namespace | KIGIT |
Functions | |
| bool | KIGIT::IsLockContention (int aGitError) |
| True when aGitError says another writer held a lock or moved a ref first. | |
| int | KIGIT::WithLockRetry (std::chrono::milliseconds aBudget, const std::function< int()> &aOp) |
| Run aOp, which returns 0 or a libgit2 error code, again after each lock contention until it succeeds, fails otherwise, or aBudget is spent. | |
| int | KIGIT::EditIndexLocked (git_repository *aRepo, const std::function< int(git_index *aIndex)> &aEdit) |
| Rewrite aRepo's index the way git does, holding index.lock from a fresh read of the file to the rename that publishes it, so staging by another writer is never overwritten. | |
| std::unique_ptr< REPO_ACTION_LOCK > | KIGIT::RepoActionLock (git_repository *aRepo, const char *aName="kicad-action") |
| The lock aName in aRepo's common git directory, which every worktree of the repository shares. | |
Variables | |
| constexpr std::chrono::milliseconds | KIGIT::BACKEND_LOCK_BUDGET { 5000 } |
| Budget for a backend call, which never runs on the UI thread. | |
Retrying short git writes that lost a race with another process.
libgit2 fails at once on a held lock where the git CLI waits. An operation is rerun whole, so it must reread whatever the lock holder may have changed.
Definition in file kigit_lock_retry.h.