Skip to content

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

Refactor: Simplify MergeOperations fields

Maximilian Roos28239a04bc20
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index 104c49707..b0858c4de 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -165,9 +165,9 @@ pub fn handle_merge(
false,
"Merged to",
Some(MergeOperations {
- committed: Some(committed),
- squashed: Some(squashed),
- rebased: Some(rebased),
+ committed,
+ squashed,
+ rebased,
}),
)?;
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index a2e738ce0..30de0bba5 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -111,9 +111,9 @@ use super::repository_ext::RepositoryCliExt;
/// Flags indicating which merge operations occurred
#[derive(Debug, Clone, Copy)]
pub struct MergeOperations {
- pub committed: Option<bool>,
- pub squashed: Option<bool>,
- pub rebased: Option<bool>,
+ pub committed: bool,
+ pub squashed: bool,
+ pub rebased: bool,
}
/// Result of a worktree switch operation
@@ -558,11 +558,11 @@ pub fn handle_push(
// Skipped operations - only include if we're in merge workflow context
if let Some(ops) = operations {
let mut skipped_ops = Vec::new();
- if !ops.committed.unwrap_or(false) && !ops.squashed.unwrap_or(false) {
+ if !ops.committed && !ops.squashed {
// Neither commit nor squash happened - combine them
skipped_ops.push("commit/squash");
}
- if !ops.rebased.unwrap_or(false) {
+ if !ops.rebased {
skipped_ops.push("rebase");
}
if !skipped_ops.is_empty() {
@@ -650,10 +650,10 @@ pub fn handle_push(
// No commits to push - for merge workflow context, acknowledge operations that didn't happen
let note = if let Some(ops) = operations {
let mut notes = Vec::new();
- if !ops.committed.unwrap_or(false) && !ops.squashed.unwrap_or(false) {
+ if !ops.committed && !ops.squashed {
notes.push("no new commits");
}
- if !ops.rebased.unwrap_or(false) {
+ if !ops.rebased {
notes.push("no rebase needed");
}
if notes.is_empty() {