improved dir-specific dynamic vars by loganfred · Pull Request #2757 · go-task/task

This PR is concerned with behavior when multiple task files are include:-ed with explicit dir: and use dynamic sh: vars.

  1. Fixes what I think is a typo where, in merges, t2.env is not being merged into t1
  2. Guards IncludedTaskfileVars so it is no longer unconditionally overwritten on each merge, otherwise in root -> parent -> A/B includes, the outer merge overwrites.
  3. Uses dir:-specific caching of sh: dynamic vars (e.g. now multiplefind . -name '*.md' is possible)
    4.taskRangeFunc should resolve t.Dir at call time, not construction time, so dir: '{{.VAR}}' variables are available

Assuming I ran it properly, the test suite passes, my minimal repro steps are resolved, and my original bug report scenario is fixed.

I am not a go programmer, this PR was overwhelmingly AI-written, I have no idea if these changes are terrible ideas, but I hope they clarify what might be going wrong in #2753

fixes #2753