From 7d92de8e440c0b2c5c306d39b56e576629de3b93 Mon Sep 17 00:00:00 2001 From: Valentin Maerten Date: Sun, 7 Jun 2026 16:16:58 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- internal/fingerprint/gitignore.go | 5 ++++- taskfile/ast/task.go | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/fingerprint/gitignore.go b/internal/fingerprint/gitignore.go index f8d75176..e74bc716 100644 --- a/internal/fingerprint/gitignore.go +++ b/internal/fingerprint/gitignore.go @@ -64,11 +64,14 @@ func readGitignoreLines(path string) []string { var lines []string scanner := bufio.NewScanner(f) for scanner.Scan() { - line := scanner.Text() + line := strings.TrimRight(scanner.Text(), "\r") if line != "" && !strings.HasPrefix(line, "#") { lines = append(lines, line) } } + if err := scanner.Err(); err != nil { + return nil + } return lines } diff --git a/taskfile/ast/task.go b/taskfile/ast/task.go index c9d2c207..9465c777 100644 --- a/taskfile/ast/task.go +++ b/taskfile/ast/task.go @@ -76,8 +76,8 @@ func (t *Task) IsSilent() bool { return t.Silent != nil && *t.Silent } -// ShouldUseGitignore returns true if the task has gitignore filtering explicitly enabled. -// Returns false if UseGitignore is nil (not set) or explicitly set to false. +// ShouldUseGitignore returns true if gitignore filtering is enabled for the task. +// Returns false if UseGitignore is nil or set to false. func (t *Task) ShouldUseGitignore() bool { return t.UseGitignore != nil && *t.UseGitignore }