refactor(tvix/nar-bridge): use castorev1pb.RenamedNode
We can use the helper to rename the node. Change-Id: Id8defea7e5ebbd43d7b7a9b2992c62084e1828ec Reviewed-on: https://cl.tvl.fyi/c/depot/+/9601 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Brian McGee <brian@bmcgee.ie> Tested-by: BuildkiteCI
This commit is contained in:
parent
2699b61052
commit
6fe34b7ba0
4 changed files with 35 additions and 100 deletions
|
|
@ -247,16 +247,7 @@ func (p *PathInfoServiceServer) Get(ctx context.Context, getPathInfoRequest *sto
|
|||
panic(err)
|
||||
}
|
||||
|
||||
// set the root name in all three cases.
|
||||
if node := pathInfo.Node.GetDirectory(); node != nil {
|
||||
node.Name = []byte(outPath.String())
|
||||
} else if node := pathInfo.Node.GetFile(); node != nil {
|
||||
node.Name = []byte(outPath.String())
|
||||
} else if node := pathInfo.Node.GetSymlink(); node != nil {
|
||||
node.Name = []byte(outPath.String())
|
||||
} else {
|
||||
panic("node may not be nil")
|
||||
}
|
||||
pathInfo.Node = castorev1pb.RenamedNode(pathInfo.Node, outPath.String())
|
||||
|
||||
// run Validate on the PathInfo, more as an additional sanity check our code is sound,
|
||||
// to make sure we populated everything properly, before returning it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue