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 <flokli@flokli.de> Reviewed-by: Connor Brewster <cbrewster@hey.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
8181817e53
commit
72d3f9b914
1 changed files with 2 additions and 6 deletions
|
|
@ -292,17 +292,13 @@ where
|
||||||
fetch: Fetch,
|
fetch: Fetch,
|
||||||
) -> Result<(StorePathRef<'a>, Node), FetcherError> {
|
) -> Result<(StorePathRef<'a>, Node), FetcherError> {
|
||||||
// Fetch file, return the (unnamed) (File)Node of its contents, ca hash and filesize.
|
// 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.
|
// 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)?;
|
let store_path = build_ca_path(name, &ca_hash, Vec::<String>::new(), false)?;
|
||||||
|
|
||||||
// Rename the node name to match the Store Path.
|
// Rename the node name to match the Store Path.
|
||||||
if let Node::File(file_node) = &mut node {
|
let node = node.rename(store_path.to_string().into());
|
||||||
file_node.name = store_path.to_string().into();
|
|
||||||
} else {
|
|
||||||
unreachable!("Tvix bug: do_fetch for URL returned non-FileNode");
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the resulting hash is not a CAHash::Nar, we also need to invoke
|
// 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
|
// `calculate_nar` to calculate this representation, as it's required in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue