fix: globals vars are available in vars at root level by vmaerten · Pull Request #2403 · go-task/task
marked this pull request as ready for review
vmaerten
deleted the
fix/globals-vars-available
branch
vmaerten added a commit that referenced this pull request
Dec 18, 2025When using `task FOO=bar` with a Taskfile containing
`FOO: '{{.FOO | default "foo"}}'`, the CLI value was being
overwritten by the Taskfile default.
The ReverseMerge function was incorrectly allowing Taskfile
variables to overwrite CLI globals. Now it skips variables
that already exist in the CLI globals, ensuring user-provided
values take priority while still making CLI globals available
for templating.
Fixes regression introduced in #2403.
vmaerten added a commit that referenced this pull request
Dec 18, 2025When using `task FOO=bar` with a Taskfile containing
`FOO: '{{.FOO | default "foo"}}'`, the CLI value was being
overwritten by the Taskfile default.
Split the variable merging into two steps:
1. Merge CLI variables (FOO=bar) first so they override Taskfile vars
2. ReverseMerge special variables (CLI_ARGS, CLI_FORCE, etc.) so
they're available for templating in Taskfile vars
Fixes regression introduced in #2403.
Co-authored-by: Timothy Rule <timothy.rule@gmail.com>
andreynering pushed a commit that referenced this pull request
Dec 18, 2025When using `task FOO=bar` with a Taskfile containing
`FOO: '{{.FOO | default "foo"}}'`, the CLI value was being
overwritten by the Taskfile default.
Split the variable merging into two steps:
1. Merge CLI variables (FOO=bar) first so they override Taskfile vars
2. ReverseMerge special variables (CLI_ARGS, CLI_FORCE, etc.) so
they're available for templating in Taskfile vars
Fixes regression introduced in #2403.
Co-authored-by: Timothy Rule <timothy.rule@gmail.com>
Copilot AI pushed a commit to libor-m/task that referenced this pull request
Mar 27, 2026Copilot AI pushed a commit to libor-m/task that referenced this pull request
Mar 27, 2026Copilot AI pushed a commit to libor-m/task that referenced this pull request
Mar 27, 2026…sk#2589) When using `task FOO=bar` with a Taskfile containing `FOO: '{{.FOO | default "foo"}}'`, the CLI value was being overwritten by the Taskfile default. Split the variable merging into two steps: 1. Merge CLI variables (FOO=bar) first so they override Taskfile vars 2. ReverseMerge special variables (CLI_ARGS, CLI_FORCE, etc.) so they're available for templating in Taskfile vars Fixes regression introduced in go-task#2403. Co-authored-by: Timothy Rule <timothy.rule@gmail.com> Co-authored-by: libor-m <1497769+libor-m@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters