fix: dynamic var uses wrong dir#2931
Conversation
|
This reminds me of #524 where a solution is presented What I mean is, probably, the cause of the problem is not: "var uses the wrong dir". Looking at this PR makes me wonder if the hash of a Task could be used as par of the index: for global vars the hash would be |
I found it doesn't work for some situation like this: the same task run with different dirs when its tasks:
default:
cmds:
- task: build
vars: { PROJECT: dir1 }
- task: build
vars: { PROJECT: dir2 }
build:
dir: "{{.PROJECT}}"
vars:
HERE:
sh: pwd
cmds:
- echo "{{.HERE}}"
- echo "{{.PROJECT}}"Expecte |
thats true |
The shell command value which stored using the command as a cache key may have collisions with the same command
but different dir. When the command value is related with dir, it will get a wrong command value.
Close #2928
I used AI assistant to inspect the repo structure and help with tests.