Skip to content

Conversation

@vmaerten
Copy link
Member

@vmaerten vmaerten commented Aug 25, 2025

Fixes #2397
From @trulede :
fixes #1580
fixes #1565 (probably)
fixes #2090
fixes #1108

Global vars are currently added after Taskfile variables, making them unavailable. This PR applies a ReverseMerge so globals are added first, then Taskfile variables.

@vmaerten vmaerten marked this pull request as ready for review August 25, 2025 19:02
@vmaerten vmaerten requested review from andreynering and pd93 August 25, 2025 19:28
@trulede
Copy link
Contributor

trulede commented Aug 29, 2025

See #2288 for a list of issues this probably fixes.

@vmaerten vmaerten merged commit 5889ff6 into main Dec 12, 2025
13 checks passed
@vmaerten vmaerten deleted the fix/globals-vars-available branch December 12, 2025 20:20
vmaerten added a commit that referenced this pull request Dec 12, 2025
vmaerten added a commit that referenced this pull request Dec 18, 2025
When 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, 2025
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 #2403.

Co-authored-by: Timothy Rule <[email protected]>
andreynering pushed a commit that referenced this pull request Dec 18, 2025
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 #2403.

Co-authored-by: Timothy Rule <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants