Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/fingerprint/glob.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package fingerprint
import (
"os"
"sort"
"strings"

"github.com/go-task/task/v3/internal/execext"
"github.com/go-task/task/v3/internal/filepathext"
Expand All @@ -25,6 +26,7 @@ func Globs(dir string, globs []*ast.Glob) ([]string, error) {

func glob(dir string, g string) ([]string, error) {
g = filepathext.SmartJoin(dir, g)
g = strings.ReplaceAll(g, " ", `\ `)

fs, err := execext.ExpandFields(g)
if err != nil {
Expand Down
17 changes: 15 additions & 2 deletions internal/fingerprint/sources_timestamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,21 @@ func (checker *TimestampChecker) IsUpToDate(t *ast.Task) (bool, error) {
if err != nil {
return false, nil
}
generates, err := Globs(t.Dir, t.Generates)
if err != nil {
generates := []string{}
for _, g := range t.Generates {
if g.Negate {
continue // 'excludes' not considered for generates.
}
files, err := glob(t.Dir, g.Glob)
if os.IsNotExist(err) || len(files) == 0 {
return false, nil
}
if err != nil {
return false, err
}
generates = append(generates, files...)
}
if len(generates) == 0 {
return false, nil
}

Expand Down
Loading