From 981fc29284e10b1bc5b6302dcbcd9ec0bf94c91e Mon Sep 17 00:00:00 2001 From: pajama-coder Date: Wed, 20 Nov 2024 10:31:48 +0800 Subject: [PATCH] [fix] Fixed bug where committing one codebase could potentially erase all files of another codebase --- src/codebase-store.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/codebase-store.cpp b/src/codebase-store.cpp index ded37246..6d93410e 100644 --- a/src/codebase-store.cpp +++ b/src/codebase-store.cpp @@ -432,7 +432,9 @@ void CodebaseStore::generate_files( const std::map &files ) { std::set old_keys; - m_store->keys(KEY_file_tree(codebase_path), old_keys); + auto base_file_path = KEY_file_tree(codebase_path); + if (base_file_path.back() != '/') base_file_path += '/'; + m_store->keys(base_file_path, old_keys); for (const auto &i : files) { auto &path = i.first;