navid/veins / commit
824afacc5a57
Navid M <navidmomtahen@gmail.com> · 2026-11-29
parents: 6169bc0f55b5
Browse files at this commit · Download source
--- a/xveins/src/worktree/worktree.cpp+++ b/xveins/src/worktree/worktree.cpp@@ -846,8 +846,13 @@ workers = 1; workers = std::min<std::size_t>(workers, files.size()); workers = std::min<std::size_t>(workers, 16);- if (workers > 1)+ if (workers > 1) { store.preload();+ // Promisor fetches add packs while the store is being read; keep+ // lazy checkouts serial so those refills cannot race the readers.+ if (store.has_promisor(root))+ workers = 1;+ } std::atomic<std::size_t> next{0}; std::atomic<bool> failed{false}; std::mutex error_mutex;--- a/xveins/tests/integration/protocol_tests.cpp+++ b/xveins/tests/integration/protocol_tests.cpp@@ -116,6 +116,32 @@ f.failed({"pull"}, "diverged", clone_a); t.expect(!f.exists("b2.txt", clone_a));+}++void protocol_lazy_checkout_old_commit(test::Context& t) {+ VnFixture f;+ const fs::path source = f.root / "source";+ fs::create_directories(source);+ f.init(source);+ for (int i = 1; i <= 20; ++i)+ f.write("f" + std::to_string(i) + ".txt", "old " + std::to_string(i) + "\n", source);+ f.write("a.txt", "hello\n", source);+ f.vn({"bmk", "set", "master"}, source);+ f.commit("initial", source);+ f.vn({"access", "anonymous", "on"}, source);++ for (int i = 1; i <= 20; ++i)+ f.write("f" + std::to_string(i) + ".txt", "new " + std::to_string(i) + "\n", source);+ f.write("a.txt", "updated\n", source);+ f.commit("second", source);+ const std::string first = f.commit_for_message("initial", source);++ const fs::path clone = f.root / "clone";+ f.vn({"clone", "file://" + source.string(), clone.string()}, f.root);+ f.vn({"co", first}, clone);+ t.expect_eq(f.read("a.txt", clone), "hello\n");+ t.expect_eq(f.read("f1.txt", clone), "old 1\n");+ t.expect_contains(f.vn({"stat"}, clone).out, "working copy clean"); } void protocol_bad_inputs(test::Context& t) {@@ -145,6 +171,7 @@ {"push_fetch", protocol_push_fetch}, {"pull_fast_forwards_and_detects_divergence", protocol_pull_fast_forwards_and_detects_divergence},+ {"lazy_checkout_old_commit", protocol_lazy_checkout_old_commit}, {"bad_inputs", protocol_bad_inputs}, }}; }