mirror of
https://github.com/max-sixty/worktrunk.git
synced 2026-09-14 20:00:38 +08:00
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:
@@ -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"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -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 }}",
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ exit_code: 0
|
|||||||
[107m [0m [2m[0m[2m[32mworld'[0m
|
[107m [0m [2m[0m[2m[32mworld'[0m
|
||||||
[107m [0m [2m[0m[2m[34mcargo[0m[2m build [0m[2m[36m--release[0m[2m [0m[2m[36m&&[0m
|
[107m [0m [2m[0m[2m[34mcargo[0m[2m build [0m[2m[36m--release[0m[2m [0m[2m[36m&&[0m
|
||||||
[107m [0m [2m[0m[2m[34mcargo[0m[2m test[0m
|
[107m [0m [2m[0m[2m[34mcargo[0m[2m test[0m
|
||||||
[107m [0m [2m[0m[2m[34mcp[0m[2m [0m[2m[32m{{[0m[2m repo_root [0m[2m[32m}}[0m[2m/target [0m[2m[32m{{[0m[2m worktree [0m[2m[32m}}[0m[2m/target[0m
|
[107m [0m [2m[0m[2m[34mcp[0m[2m [0m[2m[32m{{[0m[2m repo_path [0m[2m[32m}}[0m[2m/target [0m[2m[32m{{[0m[2m worktree_path [0m[2m[32m}}[0m[2m/target[0m
|
||||||
|
|
||||||
[2m○[22m Prompt formatting:
|
[2m○[22m Prompt formatting:
|
||||||
[36m❯[39m [36mProceed? [y/N][39m
|
[36m❯[39m [36mProceed? [y/N][39m
|
||||||
|
|||||||
Reference in New Issue
Block a user