Skip to content

Commit

Permalink
fix logic for determining root package (#3421)
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha41575 committed Jul 29, 2022
1 parent 23240bd commit 208b4c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/pkg/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ type Pkg struct {
// Use ReadKptfile or ReadPipeline on the return value to read meta resources from filesystem.
func New(fs filesys.FileSystem, path string) (*Pkg, error) {
if !filepath.IsAbs(path) {
return nil, fmt.Errorf("need absolute path")
return nil, fmt.Errorf("provided path %s must be absolute", path)
}
absPath := filepath.Clean(path)
pkg := &Pkg{
Expand Down
2 changes: 1 addition & 1 deletion porch/pkg/engine/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func writeResources(fs filesys.FileSystem, resources repository.PackageResources
if base == "Kptfile" {
// Found Kptfile. Check if the current directory is ancestor of the current
// topmost package directory. If so, use it instead.
if packageDir == "" || strings.HasPrefix(packageDir, dir+"/") {
if packageDir == "" || dir == "/" || strings.HasPrefix(packageDir, dir+"/") {
packageDir = dir
}
}
Expand Down

0 comments on commit 208b4c4

Please sign in to comment.