Skip to content

Commit

Permalink
bugfix: proper until calculation for content created outside packages
Browse files Browse the repository at this point in the history
  • Loading branch information
letFunny committed Aug 30, 2024
1 parent 9e2ecfb commit ee83c93
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/slicer/slicer.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,15 @@ func Run(options *RunOptions) error {
}
}
for relPath, slices := range relPaths {
// All the pathInfo(s) are equivalent because of conflict validation.
until := setup.UntilMutate
for _, slice := range slices {
if slice.Contents[relPath].Until == setup.UntilNone {
until = setup.UntilNone
break
}
}
pathInfo := slices[0].Contents[relPath]
pathInfo.Until = until
data := pathData{
until: pathInfo.Until,
mutable: pathInfo.Mutable,
Expand Down
24 changes: 24 additions & 0 deletions internal/slicer/slicer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,30 @@ var slicerTests = []slicerTest{{
},
filesystem: map[string]string{},
manifestPaths: map[string]string{},
}, {
summary: "Content not created in packages with until:mutate on one and reading from script",
slices: []setup.SliceKey{
{"test-package", "myslice1"},
{"test-package", "myslice2"},
},
release: map[string]string{
"slices/mydir/test-package.yaml": `
package: test-package
slices:
myslice1:
contents:
/file: {text: foo, until: mutate}
mutate: |
content.read("/file")
myslice2:
contents:
/file: {text: foo}
mutate: |
content.read("/file")
`,
},
filesystem: map[string]string{"/file": "file 0644 2c26b46b"},
manifestPaths: map[string]string{"/file": "file 0644 2c26b46b {test-package_myslice1,test-package_myslice2}"},
}, {
summary: "Install two packages, both are recorded",
slices: []setup.SliceKey{
Expand Down

0 comments on commit ee83c93

Please sign in to comment.