From 72d3f9b91476728e0258d58ce2d15f6ad9662543 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 23 Apr 2024 16:57:57 +0300 Subject: fix(tvix/glue/fetchers): rename node name for all three types 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 Reviewed-by: Connor Brewster Tested-by: BuildkiteCI --- tvix/glue/src/fetchers.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tvix/glue/src/fetchers.rs b/tvix/glue/src/fetchers.rs index 0328f007e0..7981770eb3 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::::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 -- cgit 1.4.1