Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix(config): avoid unwrap() in commit-generation diagnostics (#3033)

Worktrunk Bot98faf9f8c4c3
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index dfaf7cc62..8e9b2d28c 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -511,7 +511,10 @@ fn render_diagnostics(out: &mut String) -> anyhow::Result<()> {
if !commit_config.is_configured() {
writeln!(out, "{}", hint_message("Commit generation not configured"))?;
} else {
- let command_display = commit_config.command.as_ref().unwrap().clone();
+ // `is_configured()` guarantees `command` is `Some` and non-empty here;
+ // `unwrap_or_default()` avoids a panic-prone `unwrap()` in this
+ // `Result`-returning function (the default is unreachable).
+ let command_display = commit_config.command.clone().unwrap_or_default();
match test_commit_generation(&commit_config) {
Ok(message) => {