about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-04-23T13·57+0300
committerclbot <clbot@tvl.fyi>2024-04-23T14·41+0000
commit72d3f9b91476728e0258d58ce2d15f6ad9662543 (patch)
tree658c16117a6cae4dde5a802da7471ce58d462665
parent8181817e53f4c0da5d7dfa1a56e296fefd929bcb (diff)
fix(tvix/glue/fetchers): rename node name for all three types r/7997
We also need to rename the node in case it's a directory or symlink at
the root.

Change-Id: I6e9957200f65991645ae3e1755b943200453dfd5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11506
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
-rw-r--r--tvix/glue/src/fetchers.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/tvix/glue/src/fetchers.rs b/tvix/glue/src/fetchers.rs
index 0328f007e006..7981770eb39a 100644
--- a/tvix/glue/src/fetchers.rs
+++ b/tvix/glue/src/fetchers.rs
@@ -292,17 +292,13 @@ where
         fetch: Fetch,
     ) -> Result<(StorePathRef<'a>, Node), FetcherError> {
         // Fetch file, return the (unnamed) (File)Node of its contents, ca hash and filesize.
-        let (mut node, ca_hash, size) = self.ingest(fetch).await?;
+        let (node, ca_hash, size) = self.ingest(fetch).await?;
 
         // Calculate the store path to return later, which is done with the ca_hash.
         let store_path = build_ca_path(name, &ca_hash, Vec::<String>::new(), false)?;
 
         // Rename the node name to match the Store Path.
-        if let Node::File(file_node) = &mut node {
-            file_node.name = store_path.to_string().into();
-        } else {
-            unreachable!("Tvix bug: do_fetch for URL returned non-FileNode");
-        }
+        let node = node.rename(store_path.to_string().into());
 
         // If the resulting hash is not a CAHash::Nar, we also need to invoke
         // `calculate_nar` to calculate this representation, as it's required in