refactor(tvix/nar-bridge): Clean up directory popping loop
This change got lost in the rebases in cl/9348. There's unnecessary `break`/`continues` that can be replaced by moving the conditional into the for loop condition. Change-Id: I559e21087630b05e483f768ab59f8067961a2eae Reviewed-on: https://cl.tvl.fyi/c/depot/+/9352 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
84aa07a736
commit
4ac6423b26
1 changed files with 4 additions and 9 deletions
|
@ -195,16 +195,11 @@ func (r *Reader) Import(
|
|||
|
||||
// We don't need to worry about the root node case, because we can only finish the root "/"
|
||||
// If we're at the end of the NAR reader (covered by the EOF check)
|
||||
for {
|
||||
// We never want to pop the root directory until we're completely done.
|
||||
if len(stack) > 1 && !strings.HasPrefix(hdr.Path, stack[len(stack)-1].path+"/") {
|
||||
for len(stack) > 1 && !strings.HasPrefix(hdr.Path, stack[len(stack)-1].path+"/") {
|
||||
err := popFromStack()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to pop from stack: %w", err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if hdr.Type == nar.TypeSymlink {
|
||||
|
|
Loading…
Reference in a new issue