mirror of
https://github.com/go-task/task.git
synced 2026-06-29 07:34:18 +00:00
feat(taskfile): skip var merge when SCOPED_INCLUDES enabled
When the SCOPED_INCLUDES experiment is enabled, variables from included Taskfiles are no longer merged globally. They remain in their original Taskfile within the DAG. Exception: flatten includes still merge variables globally to allow sharing common variables across multiple Taskfiles.
This commit is contained in:
@@ -57,7 +57,9 @@ func (tfg *TaskfileGraph) Root() (*TaskfileVertex, error) {
|
||||
return tfg.Vertex(hashes[0])
|
||||
}
|
||||
|
||||
func (tfg *TaskfileGraph) Merge() (*Taskfile, error) {
|
||||
// Merge merges all included Taskfiles into the root Taskfile.
|
||||
// If skipVarsMerge is true, variables are not merged (used for scoped includes).
|
||||
func (tfg *TaskfileGraph) Merge(skipVarsMerge bool) (*Taskfile, error) {
|
||||
hashes, err := graph.TopologicalSort(tfg.Graph)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -104,6 +106,7 @@ func (tfg *TaskfileGraph) Merge() (*Taskfile, error) {
|
||||
if err := vertex.Taskfile.Merge(
|
||||
includedVertex.Taskfile,
|
||||
include,
|
||||
skipVarsMerge,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user