feat: add use_gitignore option to exclude ignored files from sources/generates (#2773)

This commit is contained in:
Valentin Maerten
2026-06-29 15:39:33 +02:00
committed by GitHub
parent a03aa7ba69
commit 616433df75
53 changed files with 1347 additions and 43 deletions

1
testdata/gitignore/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
ignored.txt

25
testdata/gitignore/Taskfile.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
version: '3'
use_gitignore: true
tasks:
build:
cmds:
- cp ./source.txt ./generated.txt
sources:
- ./*.txt
- exclude: ./generated.txt
generates:
- ./generated.txt
method: checksum
build-no-use_gitignore:
use_gitignore: false
cmds:
- cp ./source.txt ./generated.txt
sources:
- ./*.txt
- exclude: ./generated.txt
generates:
- ./generated.txt
method: checksum

1
testdata/gitignore/source.txt vendored Normal file
View File

@@ -0,0 +1 @@
source content

View File

@@ -0,0 +1 @@
task: [build] cp ./source.txt ./generated.txt

View File

@@ -0,0 +1 @@
task: Task "build" is up to date

View File

@@ -0,0 +1 @@
task: [build] cp ./source.txt ./generated.txt

View File

@@ -0,0 +1 @@
task: Task "build" is up to date

View File

@@ -0,0 +1 @@
ignored.txt

View File

@@ -0,0 +1,9 @@
version: '3'
includes:
included: ./included/Taskfile.yml
tasks:
default:
cmds:
- echo "root"

View File

@@ -0,0 +1,11 @@
version: '3'
use_gitignore: true
tasks:
build:
cmds:
- echo "build executed"
sources:
- ./*.txt
method: checksum

View File

@@ -0,0 +1 @@
source

View File

@@ -0,0 +1,2 @@
task: [included:build] echo "build executed"
build executed

View File

@@ -0,0 +1 @@
task: Task "included:build" is up to date

View File

@@ -0,0 +1 @@
task: Task "included:build" is up to date

View File

@@ -0,0 +1 @@
ignored.txt

View File

@@ -0,0 +1,11 @@
version: '3'
use_gitignore: true
includes:
included: ./included/Taskfile.yml
tasks:
default:
cmds:
- echo "root"

View File

@@ -0,0 +1,11 @@
version: '3'
use_gitignore: false
tasks:
build:
cmds:
- echo "build executed"
sources:
- ./*.txt
method: checksum

View File

@@ -0,0 +1 @@
source

View File

@@ -0,0 +1,2 @@
task: [included:build] echo "build executed"
build executed

View File

@@ -0,0 +1,2 @@
task: [included:build] echo "build executed"
build executed

View File

@@ -0,0 +1 @@
task: Task "included:build" is up to date

View File

@@ -0,0 +1 @@
*.log

View File

@@ -0,0 +1,11 @@
version: '3'
use_gitignore: true
tasks:
build:
cmds:
- echo "build executed"
sources:
- ./sub/*.log
method: checksum

View File

@@ -0,0 +1 @@
!debug.log

View File

@@ -0,0 +1,2 @@
task: [build] echo "build executed"
build executed

View File

@@ -0,0 +1 @@
task: Task "build" is up to date

View File

@@ -0,0 +1,2 @@
task: [build] echo "build executed"
build executed

View File

@@ -0,0 +1 @@
task: Task "build" is up to date

11
testdata/gitignore_nested/Taskfile.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
version: '3'
use_gitignore: true
tasks:
build:
cmds:
- echo "build executed"
sources:
- ./sub/*
method: checksum

View File

@@ -0,0 +1 @@
secret.dat

View File

@@ -0,0 +1 @@
keep

View File

@@ -0,0 +1,2 @@
task: [build] echo "build executed"
build executed

View File

@@ -0,0 +1 @@
task: Task "build" is up to date

View File

@@ -0,0 +1,2 @@
task: [build] echo "build executed"
build executed

View File

@@ -0,0 +1 @@
task: Task "build" is up to date