From b1ab8075cd70b66b98622f5dc1b1d04cb60c7f79 Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Sun, 8 Oct 2023 17:58:08 +0200 Subject: docs(tvix/castore): point out use of contents_first Change-Id: I7620d2abe01675ea7028a478d4f8447e36d5768b Reviewed-on: https://cl.tvl.fyi/c/depot/+/9605 Tested-by: BuildkiteCI Reviewed-by: flokli --- tvix/castore/src/import.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tvix/castore') 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 + 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 + Debug>( // process_entry wants an Option 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 = { if entry.file_type().is_dir() { Some( -- cgit 1.4.1