Skip to content

Conversation

@trulede
Copy link
Contributor

@trulede trulede commented Jan 18, 2026

When task starts wthout a taskfile specified the entrypoint will be either the parameter --taskfile, which may be a directory, or the current directory. In such cases task will search for the taskfile to use. When that taskfile is found, the e.Entrypoint needs to be updated to reflect the resolved entrypoint.

Remarkably, this was not just broken, but really broken:

@blue:~/git/task/ISSUES$ task -t 1706 who-am-i
USER_WORKING_DIR = /home/blue/git/task/ISSUES
   ROOT_TASKFILE = /home/blue/git/task/ISSUES/1706/1706
        ROOT_DIR = /home/blue/git/task/ISSUES/1706
        TASKFILE = /home/blue/git/task/ISSUES/1706/Taskfile.yml
            TASK = who-am-i

even more remarkable, fixing the issue does not break any tests. The corrected output:

@blue:~/git/task/ISSUES$ task -t 1706 who-am-i
USER_WORKING_DIR = /home/blue/git/task/ISSUES
   ROOT_TASKFILE = /home/blue/git/task/ISSUES/1706/Taskfile.yml
        ROOT_DIR = /home/blue/git/task/ISSUES/1706
        TASKFILE = /home/blue/git/task/ISSUES/1706/Taskfile.yml
            TASK = who-am-i

The following taskfile used:

version: '3'

silent: true

tasks:
  who-am-i:
    cmds:
      - echo "USER_WORKING_DIR = {{.USER_WORKING_DIR}}"
      - echo "   ROOT_TASKFILE = {{.ROOT_TASKFILE}}"
      - echo "        ROOT_DIR = {{.ROOT_DIR}}"
      - echo "        TASKFILE = {{.TASKFILE}}"
      - echo "            TASK = {{.TASK}}"

fixes #1706
closes #1708

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.ROOT_TASKFILE returns the root directory instead of the file

1 participant