The configuration docs say:
All user config options can be overridden with environment variables using the WORKTRUNK_ prefix.
They specifically map worktree-path to WORKTRUNK_WORKTREE_PATH. However, a matching [projects."<id>"].worktree-path currently wins over the environment variable.
Reproduction:
tmp=$(mktemp -d) &&
git init -q -b main "$tmp/repo" &&
cd "$tmp/repo" &&
git config user.name Test &&
git config user.email test@example.com &&
touch README &&
git add README &&
git commit -qm initial &&
git remote add origin https://github.com/acme/demo.git &&
printf '[projects."github.com/acme/demo"]\nworktree-path = "%s/from-project"\n' "$tmp" > "$tmp/wt.toml" &&
WORKTRUNK_CONFIG_PATH="$tmp/wt.toml" \
WORKTRUNK_WORKTREE_PATH="$tmp/from-environment" \
wt switch --create feature --no-cd --no-hooks --yes --format=json
Actual output:
{"action":"created","branch":"feature","path":"/var/folders/2b/yvd22vqx2c95tq_lcsmf5k8w0000gn/T/tmp.y75Y7uvTHo/from-project","created_branch":true,"base_branch":"main"}
Expected: the worktree is created at $tmp/from-environment.
Actual: it is created at $tmp/from-project.
Should invocation-level overrides use this precedence?
--config-set > WORKTRUNK_WORKTREE_PATH > project config > global config
This could help my project by no longer needing this path arg resolver and this wt project config identifier. Would be happy to give this implementation a go
The configuration docs say:
They specifically map
worktree-pathtoWORKTRUNK_WORKTREE_PATH. However, a matching[projects."<id>"].worktree-pathcurrently wins over the environment variable.Reproduction:
Actual output:
{"action":"created","branch":"feature","path":"/var/folders/2b/yvd22vqx2c95tq_lcsmf5k8w0000gn/T/tmp.y75Y7uvTHo/from-project","created_branch":true,"base_branch":"main"}Expected: the worktree is created at
$tmp/from-environment.Actual: it is created at
$tmp/from-project.Should invocation-level overrides use this precedence?
This could help my project by no longer needing this path arg resolver and this wt project config identifier. Would be happy to give this implementation a go