about summary refs log tree commit diff
path: root/tvix/store
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-02-27T17·07+0100
committerflokli <flokli@flokli.de>2023-03-10T10·58+0000
commit2ef60282b61a61496e642021f0ab8eab7569bbaa (patch)
tree1a13914c1be1a7c0262c73d036639290e8c8f37f /tvix/store
parenta4d06b68d8d78c4304e7f9d53304a25f9a1ac20a (diff)
feat(tvix/store/import): make sure entries are sorted r/5938
The Directory service does already reject inserting invalid (wrongly
sorted) Directory messages, but our test case didn't provoke it.

Change-Id: I228e201925e8999186659a2d8da0118db184d9ab
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8167
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/store')
-rw-r--r--tvix/store/src/import.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/tvix/store/src/import.rs b/tvix/store/src/import.rs
index d2abb292fcce..e71798a6eb4c 100644
--- a/tvix/store/src/import.rs
+++ b/tvix/store/src/import.rs
@@ -200,8 +200,11 @@ pub fn import_path<
 
     let mut directories: HashMap<PathBuf, proto::Directory> = HashMap::default();
 
-    // TODO: make sure we traverse in sorted order, or insert to parent_directory in sorted order at least.
-    for entry in WalkDir::new(p).follow_links(false).contents_first(true) {
+    for entry in WalkDir::new(p)
+        .follow_links(false)
+        .contents_first(true)
+        .sort_by_file_name()
+    {
         let entry = entry.unwrap();
 
         // process_entry wants an Option<Directory> in case the entry points to a directory.