diff options
author | Florian Klink <flokli@flokli.de> | 2023-02-27T17·07+0100 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-03-10T10·58+0000 |
commit | 2ef60282b61a61496e642021f0ab8eab7569bbaa (patch) | |
tree | 1a13914c1be1a7c0262c73d036639290e8c8f37f | |
parent | a4d06b68d8d78c4304e7f9d53304a25f9a1ac20a (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>
-rw-r--r-- | tvix/store/src/import.rs | 7 |
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. |