Drop the last two references to retired template variables

`template_references_repo_name` in the bare-repo `worktree-path` offer still
ORed `template_references_var(template, "main_worktree")`, and a unit case
pinned that arm as `true`. The template it inspects comes from the loaded
config, which the deprecation layer has already renamed, so the arm can no
longer match — dead logic that contradicts the premise of the change.

`wt config show-theme`'s shell-highlighting sample also still rendered
`cp {{ repo_root }}/target {{ worktree }}/target`, i.e. user-visible output
advertising two names that now fail expansion. Its snapshot moves with it.
This commit is contained in:
worktrunk-bot
2026-09-13 05:26:52 +00:00
parent 2a04a85b72
commit 5dc0bd5ad9
3 changed files with 6 additions and 9 deletions
+1 -1
View File
@@ -1634,7 +1634,7 @@ pub fn handle_show_theme() {
eprintln!( eprintln!(
"{}", "{}",
format_bash_with_gutter( format_bash_with_gutter(
"eval \"$(wt config shell init bash)\"\necho 'This is a long command that will wrap to the next line when the terminal is narrow enough to require wrapping.'\necho 'hello\nworld'\ncargo build --release &&\ncargo test\ncp {{ repo_root }}/target {{ worktree }}/target" "eval \"$(wt config shell init bash)\"\necho 'This is a long command that will wrap to the next line when the terminal is narrow enough to require wrapping.'\necho 'hello\nworld'\ncargo build --release &&\ncargo test\ncp {{ repo_path }}/target {{ worktree_path }}/target"
) )
); );
+4 -7
View File
@@ -117,10 +117,12 @@ pub fn worktree_display_name(
/// Uses an absolute path (`repo_path`/../) to avoid ambiguity with relative resolution. /// Uses an absolute path (`repo_path`/../) to avoid ambiguity with relative resolution.
const BARE_REPO_WORKTREE_PATH: &str = "{{ repo_path }}/../{{ branch | sanitize }}"; const BARE_REPO_WORKTREE_PATH: &str = "{{ repo_path }}/../{{ branch | sanitize }}";
/// Check whether a template string references `{{ repo }}` or `{{ main_worktree }}`. /// Check whether a template string references `{{ repo }}`.
///
/// The template comes from the loaded config, so the deprecation layer has
/// already renamed the retired `main_worktree` to `repo` before it gets here.
fn template_references_repo_name(template: &str) -> bool { fn template_references_repo_name(template: &str) -> bool {
worktrunk::config::template_references_var(template, "repo") worktrunk::config::template_references_var(template, "repo")
|| worktrunk::config::template_references_var(template, "main_worktree")
} }
/// Offer to set a project-level `worktree-path` for bare repos with hidden directory names. /// Offer to set a project-level `worktree-path` for bare repos with hidden directory names.
@@ -281,11 +283,6 @@ mod tests {
true, true,
), ),
("repo with filter", "{{ repo | sanitize }}", true), ("repo with filter", "{{ repo | sanitize }}", true),
(
"deprecated main_worktree alias",
"{{ main_worktree }}.{{ branch }}",
true,
),
( (
"repo_path is a distinct variable", "repo_path is a distinct variable",
"{{ repo_path }}/../{{ branch | sanitize }}", "{{ repo_path }}/../{{ branch | sanitize }}",
@@ -66,7 +66,7 @@ exit_code: 0
  world'   world'
  cargo build --release &&   cargo build --release &&
  cargo test   cargo test
  cp {{ repo_root }}/target {{ worktree }}/target   cp {{ repo_path }}/target {{ worktree_path }}/target
○ Prompt formatting: ○ Prompt formatting:
 Proceed? [y/N]  Proceed? [y/N]