From 7998508a40a5447cbea5a998b27c8614c9d4d8cd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 17 Dec 2025 12:50:33 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Sergei Zimmerman --- src/libfetchers/git-utils.cc | 4 ++++ src/libutil/include/nix/util/pool.hh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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, {}); } };