mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
Merge pull request #11821 from hercules-ci/issue-11815
initRepoAtomically: Catch directory_not_empty
This commit is contained in:
commit
8f553f6eef
@ -217,8 +217,12 @@ static void initRepoAtomically(std::filesystem::path &path, bool bare) {
|
||||
try {
|
||||
std::filesystem::rename(tmpDir, path);
|
||||
} catch (std::filesystem::filesystem_error & e) {
|
||||
if (e.code() == std::errc::file_exists) // Someone might race us to create the repository.
|
||||
// Someone may race us to create the repository.
|
||||
if (e.code() == std::errc::file_exists
|
||||
// `path` may be attempted to be deleted by s::f::rename, in which case the code is:
|
||||
|| e.code() == std::errc::directory_not_empty) {
|
||||
return;
|
||||
}
|
||||
else
|
||||
throw SysError("moving temporary git repository from %s to %s", tmpDir, path);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user