diff --git a/src/libfetchers/git-utils.cc b/src/libfetchers/git-utils.cc index 81ae85f60..d6bdc1987 100644 --- a/src/libfetchers/git-utils.cc +++ b/src/libfetchers/git-utils.cc @@ -1171,6 +1171,8 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink void createRegularFile(const CanonPath & path, std::function func) override { + checkInterrupt(); + /* Multithreaded blob writing. We read the incoming file data into memory and asynchronously write it to a Git blob object. However, to avoid unbounded memory usage, if the amount of data in flight exceeds a threshold, we switch to writing directly to a Git write stream. */ @@ -1334,6 +1336,8 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink auto repo(repoPool.get()); [&](this const auto & visit, Directory & node) -> void { + checkInterrupt(); + // Write the child directories. for (auto & child : node.children) if (auto dir = std::get_if(&child.second.file)) diff --git a/src/libutil/include/nix/util/pool.hh b/src/libutil/include/nix/util/pool.hh index 5afadc72c..952c29ad5 100644 --- a/src/libutil/include/nix/util/pool.hh +++ b/src/libutil/include/nix/util/pool.hh @@ -215,7 +215,7 @@ public: std::vector> clear() { auto state_(state.lock()); - return std::move(state_->idle); + return std::exchange(state_->idle, {}); } };