about summary refs log tree commit diff
path: root/tvix/castore
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2023-10-08T15·58+0200
committerLinus Heckemann <git@sphalerite.org>2023-10-13T17·14+0000
commitb1ab8075cd70b66b98622f5dc1b1d04cb60c7f79 (patch)
treee45f71126c246bc0b81ddb9866a6ce64701fe9e4 /tvix/castore
parent64beaab16338518b016a151196b8305604ec0764 (diff)
docs(tvix/castore): point out use of contents_first r/6796
Change-Id: I7620d2abe01675ea7028a478d4f8447e36d5768b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9605
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/castore')
-rw-r--r--tvix/castore/src/import.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tvix/castore/src/import.rs b/tvix/castore/src/import.rs
index 4c0037e34a33..65f2a30eeae2 100644
--- a/tvix/castore/src/import.rs
+++ b/tvix/castore/src/import.rs
@@ -155,6 +155,9 @@ pub async fn ingest_path<P: AsRef<Path> + Debug>(
     for entry in WalkDir::new(p)
         .follow_links(false)
         .follow_root_links(false)
+        // We need to process a directory's children before processing
+        // the directory itself in order to have all the data needed
+        // to compute the hash.
         .contents_first(true)
         .sort_by_file_name()
     {
@@ -162,6 +165,8 @@ pub async fn ingest_path<P: AsRef<Path> + Debug>(
 
         // process_entry wants an Option<Directory> in case the entry points to a directory.
         // make sure to provide it.
+        // If the directory has contents, we already have it in
+        // `directories` due to the use of contents_first on WalkDir.
         let maybe_directory: Option<Directory> = {
             if entry.file_type().is_dir() {
                 Some(