about summary refs log tree commit diff
path: root/tvix/nar-bridge/pkg/reader/reader.go
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/nar-bridge/pkg/reader/reader.go')
-rw-r--r--tvix/nar-bridge/pkg/reader/reader.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/tvix/nar-bridge/pkg/reader/reader.go b/tvix/nar-bridge/pkg/reader/reader.go
index 9ff7b3fedb..04e1e6f2ae 100644
--- a/tvix/nar-bridge/pkg/reader/reader.go
+++ b/tvix/nar-bridge/pkg/reader/reader.go
@@ -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+"/") {
-					err := popFromStack()
-					if err != nil {
-						return nil, fmt.Errorf("unable to pop from stack: %w", err)
-					}
-					continue
+			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)
 				}
-				break
 			}
 
 			if hdr.Type == nar.TypeSymlink {