diff --git a/internal/setup/setup_test.go b/internal/setup/setup_test.go index ec61490b..2bda79c5 100644 --- a/internal/setup/setup_test.go +++ b/internal/setup/setup_test.go @@ -878,6 +878,18 @@ var setupTests = []setupTest{{ `, }, relerror: `slice mypkg_myslice mutable is not a regular file: /path`, +}, { + summary: "Mutable path cannot have 'until' set to mutate", + input: map[string]string{ + "slices/mydir/mypkg.yaml": ` + package: mypkg + slices: + myslice: + contents: + /path: {text: data, mutable: true, until: mutate} + `, + }, + relerror: `slice mypkg_myslice cannot have both 'mutable' and 'until: mutate' for path /path`, }, { summary: "Until checks its value for validity", input: map[string]string{ diff --git a/internal/setup/yaml.go b/internal/setup/yaml.go index 1760f1b4..2ebbf352 100644 --- a/internal/setup/yaml.go +++ b/internal/setup/yaml.go @@ -666,6 +666,9 @@ func parsePackage(release *Release, pkgName, pkgPath string, data []byte) (*Pack if mutable && kinds[0] != TextPath && (kinds[0] != CopyPath || isDir) { return nil, fmt.Errorf("slice %s_%s mutable is not a regular file: %s", pkg.Name, sliceName, contPath) } + if mutable && until == UntilMutate { + return nil, fmt.Errorf("slice %s_%s cannot have both 'mutable' and 'until: mutate' for path %s", pkg.Name, sliceName, contPath) + } slice.Contents[contPath] = PathInfo{ Kind: kinds[0], Info: info,