Skip to content

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

fix(step): refuse to commit unresolved conflicts; one gutter symbol for every operation (#3579)

Maximilian Roosf5d99d4fe50a
diff --git a/docs/content/list.md b/docs/content/list.md
index 35425cbea..abbc5c461 100644
--- a/docs/content/list.md
+++ b/docs/content/list.md
@@ -164,13 +164,12 @@ Independent flags from `git status`; several can show at once (e.g. `+!?`). Each
### Worktree
-An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (`✘ > ⤴ > ⤵ > ⊟ > ⊞ > ⚑ > /`):
+An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (`✘ > ↻ > ⊟ > ⊞ > ⚑ > /`):
| Symbol | JSON | Meaning |
|--------|------|---------|
| `✘` | `operation_state` `"conflicts"` | Merge conflicts |
-| `⤴` | `operation_state` `"rebase"` | Rebase in progress |
-| `⤵` | `operation_state` `"merge"` | Merge in progress |
+| `↻` | `operation_state` `"rebase"`, `"merge"`, `"cherry_pick"`, `"revert"`, `"bisect"` | A git operation is in progress; `git status` names it |
| `⊟` | `worktree.state` `"prunable"` | Prunable (worktree directory missing) |
| `⊞` | `worktree.state` `"locked"` | Locked worktree |
| `⚑` | `worktree.state` `"branch_worktree_mismatch"` | Branch name doesn't match the worktree path |
diff --git a/plugins/worktrunk/skills/worktrunk/reference/list.md b/plugins/worktrunk/skills/worktrunk/reference/list.md
index 5f0594fdf..85e5b4942 100644
--- a/plugins/worktrunk/skills/worktrunk/reference/list.md
+++ b/plugins/worktrunk/skills/worktrunk/reference/list.md
@@ -149,13 +149,12 @@ Independent flags from `git status`; several can show at once (e.g. `+!?`). Each
### Worktree
-An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (`✘ > ⤴ > ⤵ > ⊟ > ⊞ > ⚑ > /`):
+An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (`✘ > ↻ > ⊟ > ⊞ > ⚑ > /`):
| Symbol | JSON | Meaning |
|--------|------|---------|
| `✘` | `operation_state` `"conflicts"` | Merge conflicts |
-| `⤴` | `operation_state` `"rebase"` | Rebase in progress |
-| `⤵` | `operation_state` `"merge"` | Merge in progress |
+| `↻` | `operation_state` `"rebase"`, `"merge"`, `"cherry_pick"`, `"revert"`, `"bisect"` | A git operation is in progress; `git status` names it |
| `⊟` | `worktree.state` `"prunable"` | Prunable (worktree directory missing) |
| `⊞` | `worktree.state` `"locked"` | Locked worktree |
| `⚑` | `worktree.state` `"branch_worktree_mismatch"` | Branch name doesn't match the worktree path |
diff --git a/skills/worktrunk/reference/list.md b/skills/worktrunk/reference/list.md
index 5f0594fdf..85e5b4942 100644
--- a/skills/worktrunk/reference/list.md
+++ b/skills/worktrunk/reference/list.md
@@ -149,13 +149,12 @@ Independent flags from `git status`; several can show at once (e.g. `+!?`). Each
### Worktree
-An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (`✘ > ⤴ > ⤵ > ⊟ > ⊞ > ⚑ > /`):
+An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (`✘ > ↻ > ⊟ > ⊞ > ⚑ > /`):
| Symbol | JSON | Meaning |
|--------|------|---------|
| `✘` | `operation_state` `"conflicts"` | Merge conflicts |
-| `⤴` | `operation_state` `"rebase"` | Rebase in progress |
-| `⤵` | `operation_state` `"merge"` | Merge in progress |
+| `↻` | `operation_state` `"rebase"`, `"merge"`, `"cherry_pick"`, `"revert"`, `"bisect"` | A git operation is in progress; `git status` names it |
| `⊟` | `worktree.state` `"prunable"` | Prunable (worktree directory missing) |
| `⊞` | `worktree.state` `"locked"` | Locked worktree |
| `⚑` | `worktree.state` `"branch_worktree_mismatch"` | Branch name doesn't match the worktree path |
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 07aa99a39..4e229505b 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -905,13 +905,12 @@ Independent flags from `git status`; several can show at once (e.g. `+!?`). Each
### Worktree
-An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (`✘ > ⤴ > ⤵ > ⊟ > ⊞ > ⚑ > /`):
+An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (`✘ > ↻ > ⊟ > ⊞ > ⚑ > /`):
| Symbol | JSON | Meaning |
|--------|------|---------|
| `✘` | `operation_state` `"conflicts"` | Merge conflicts |
-| `⤴` | `operation_state` `"rebase"` | Rebase in progress |
-| `⤵` | `operation_state` `"merge"` | Merge in progress |
+| `↻` | `operation_state` `"rebase"`, `"merge"`, `"cherry_pick"`, `"revert"`, `"bisect"` | A git operation is in progress; `git status` names it |
| `⊟` | `worktree.state` `"prunable"` | Prunable (worktree directory missing) |
| `⊞` | `worktree.state` `"locked"` | Locked worktree |
| `⚑` | `worktree.state` `"branch_worktree_mismatch"` | Branch name doesn't match the worktree path |
diff --git a/src/commands/commit.rs b/src/commands/commit.rs
index 66b57067c..eabd793be 100644
--- a/src/commands/commit.rs
+++ b/src/commands/commit.rs
@@ -222,6 +222,15 @@ impl CommitOptions<'_> {
/// share one announce line; standalone callers (e.g. `wt commit`)
/// construct an announcer of their own and flush right after.
pub fn commit(self, announcer: &mut HookAnnouncer<'_>) -> anyhow::Result<CommitOutcome> {
+ // Use the worktree path from context — this is the target worktree when
+ // --branch is specified, or the current worktree otherwise.
+ let wt = self.ctx.repo.worktree_at(self.ctx.worktree_path);
+
+ // Refuse before hooks, staging, or any announcement: auto-staging an
+ // unmerged path is what would put conflict markers in the commit, and
+ // nothing below is worth doing for a commit that cannot happen.
+ wt.ensure_no_unmerged_paths("commit")?;
+
let project_config = self.ctx.repo.load_project_config()?;
let user_hooks = self.ctx.config.hooks(self.ctx.project_id().as_deref());
let any_hooks_exist = user_hooks.get(HookType::PreCommit).is_some()
@@ -250,10 +259,6 @@ impl CommitOptions<'_> {
)?;
}
- // Use the worktree path from context — this is the target worktree when
- // --branch is specified, or the current worktree otherwise.
- let wt = self.ctx.repo.worktree_at(self.ctx.worktree_path);
-
if self.warn_about_untracked && self.stage_mode == StageMode::All {
let status = wt
.run_command(&["status", "--porcelain", "-z"])
diff --git a/src/commands/list/collect/execution.rs b/src/commands/list/collect/execution.rs
index 64064e18d..0d49cee95 100644
--- a/src/commands/list/collect/execution.rs
+++ b/src/commands/list/collect/execution.rs
@@ -24,9 +24,7 @@ use std::sync::Arc;
use crossbeam_channel as chan;
use worktrunk::git::{BranchRef, Repository, WorktreeInfo};
-use super::super::model::{
- ActiveGitOperation, ItemKind, ListItem, UpstreamStatus, WorkingTreeStatus,
-};
+use super::super::model::{ItemKind, ListItem, UpstreamStatus, WorkingTreeStatus};
use super::CollectOptions;
use super::tasks::{
AheadBehindTask, BranchDiffTask, CiStatusTask, CommittedTreesMatchTask, GitOperationTask,
@@ -245,7 +243,7 @@ pub(super) fn seed_skipped_task_defaults(item: &mut ListItem, kind: TaskKind) {
}
TaskKind::GitOperation => {
if let ItemKind::Worktree(data) = &mut item.kind {
- data.git_operation = Some(ActiveGitOperation::None);
+ data.git_operation = Some(None);
}
}
}
diff --git a/src/commands/list/collect/tasks.rs b/src/commands/list/collect/tasks.rs
index b0dd95c09..0e192a9e8 100644
--- a/src/commands/list/collect/tasks.rs
+++ b/src/commands/list/collect/tasks.rs
@@ -10,14 +10,11 @@ use std::sync::Arc;
use anyhow::Context;
use worktrunk::git::{
- ErrorExt, InProgressOperation, IntegrationTargets, LineDiff, RefSnapshot, Repository,
- select_comparison_base,
+ ErrorExt, IntegrationTargets, LineDiff, RefSnapshot, Repository, select_comparison_base,
};
use super::super::ci_status::{CiBranchName, PrStatus};
-use super::super::model::{
- ActiveGitOperation, AheadBehind, BranchDiffTotals, UpstreamStatus, WorkingTreeStatus,
-};
+use super::super::model::{AheadBehind, BranchDiffTotals, UpstreamStatus, WorkingTreeStatus};
use super::types::{ErrorCause, TaskError, TaskKind, TaskResult};
// ============================================================================
@@ -778,7 +775,7 @@ impl Task for WorkingTreeConflictsTask {
}
}
-/// Task 7 (worktree only): Git operation state detection (rebase/merge)
+/// Task 7 (worktree only): Git operation state detection (rebase, merge, …)
pub struct GitOperationTask;
impl Task for GitOperationTask {
@@ -790,7 +787,9 @@ impl Task for GitOperationTask {
.branch_ref
.working_tree(&ctx.repo)
.ok_or_else(|| ctx.error(Self::KIND, &anyhow::anyhow!("requires a worktree")))?;
- let git_operation = detect_active_git_operation(&wt);
+ let git_operation = wt
+ .operation_in_progress()
+ .map_err(|e| ctx.error(Self::KIND, &e))?;
Ok(TaskResult::GitOperation {
item_idx: ctx.item_idx,
git_operation,
@@ -993,22 +992,6 @@ fn first_line(s: &str) -> String {
.to_string()
}
-/// Detect if a worktree is in the middle of a git operation (rebase/merge).
-///
-/// The gutter symbols cover the two operations `wt merge` itself performs, so
-/// the states with no symbol of their own (cherry-pick, revert, bisect) report
-/// as `None` here — they still block the commit-replaying commands, via
-/// `ensure_no_operation_in_progress`.
-pub(crate) fn detect_active_git_operation(
- wt: &worktrunk::git::WorkingTree<'_>,
-) -> ActiveGitOperation {
- match wt.operation_in_progress() {
- Ok(Some(InProgressOperation::Rebase)) => ActiveGitOperation::Rebase,
- Ok(Some(InProgressOperation::Merge)) => ActiveGitOperation::Merge,
- _ => ActiveGitOperation::None,
- }
-}
-
/// Parse port number from a URL string (e.g., "http://localhost:12345" -> 12345)
pub(crate) fn parse_port_from_url(url: &str) -> Option<u16> {
// Strip scheme
diff --git a/src/commands/list/collect/types.rs b/src/commands/list/collect/types.rs
index ecf4fc053..34b17c68c 100644
--- a/src/commands/list/collect/types.rs
+++ b/src/commands/list/collect/types.rs
@@ -5,12 +5,10 @@
//! - `TaskError` and `ErrorCause` - error handling for failed tasks
//! - `DrainOutcome` and `MissingResult` - timeout diagnostic info
-use worktrunk::git::LineDiff;
+use worktrunk::git::{InProgressOperation, LineDiff};
use super::super::ci_status::PrStatus;
-use super::super::model::{
- ActiveGitOperation, AheadBehind, BranchDiffTotals, UpstreamStatus, WorkingTreeStatus,
-};
+use super::super::model::{AheadBehind, BranchDiffTotals, UpstreamStatus, WorkingTreeStatus};
/// Task results sent as each git operation completes.
/// These enable progressive rendering - update UI as data arrives.
@@ -85,10 +83,10 @@ pub(crate) enum TaskResult {
/// Some(false) = dirty working tree would not conflict
has_working_tree_conflicts: Option<bool>,
},
- /// Git operation in progress (rebase/merge)
+ /// Git operation in progress, `None` when there is none
GitOperation {
item_idx: usize,
- git_operation: ActiveGitOperation,
+ git_operation: Option<InProgressOperation>,
},
/// User-defined status from git config
UserMarker {
diff --git a/src/commands/list/json_output.rs b/src/commands/list/json_output.rs
index 2838296f6..d8bca56b8 100644
--- a/src/commands/list/json_output.rs
+++ b/src/commands/list/json_output.rs
@@ -531,7 +531,7 @@ pub(crate) fn format_raw_symbols(symbols: &super::model::StatusSymbols) -> Strin
}
}
- // Worktree state (gate 2) — operations (✘⤴⤵) take priority over
+ // Worktree state (gate 2) — operations (✘↻) take priority over
// location (/⚑⊟⊞). Gate 2 is "operation_state is Some"; the metadata
// worktree_state is filled synchronously and always Some by the time
// the operation family is known.
@@ -589,12 +589,13 @@ pub fn to_json_items(
mod tests {
use insta::assert_snapshot;
use worktrunk::git::GitRepoProvider;
+ use worktrunk::git::InProgressOperation;
use super::*;
use crate::commands::list::ci_status::{CiStatus, PrRef};
use crate::commands::list::model::{
- ActiveGitOperation, Divergence, MainState, OperationState, StatusSymbols,
- WorkingTreeStatus, WorktreeData, WorktreeState,
+ Divergence, MainState, OperationState, StatusSymbols, WorkingTreeStatus, WorktreeData,
+ WorktreeState,
};
// ============================================================================
@@ -822,7 +823,7 @@ mod tests {
working_tree_status: None,
has_conflicts: None,
has_working_tree_conflicts: None,
- git_operation: Some(ActiveGitOperation::None),
+ git_operation: Some(None),
branch_worktree_mismatch: false,
}
}
@@ -939,14 +940,14 @@ mod tests {
// Operation state takes priority over worktree state
let operation = format_raw_symbols(&StatusSymbols {
- operation_state: Some(OperationState::Rebase),
+ operation_state: Some(OperationState::InProgress(InProgressOperation::Rebase)),
..Default::default()
});
- assert_snapshot!(operation, @"⤴");
+ assert_snapshot!(operation, @"↻");
// Worktree metadata renders only once the operation-family gate
// has resolved to "no operation" — otherwise we can't rule out
- // ✘⤴⤵ taking priority. Callers that want just the metadata
+ // ✘↻ taking priority. Callers that want just the metadata
// symbol must set both `operation_state` and `worktree_state`.
let worktree = format_raw_symbols(&StatusSymbols {
operation_state: Some(OperationState::None),
diff --git a/src/commands/list/json_v2.rs b/src/commands/list/json_v2.rs
index 2e26d6222..234207ec3 100644
--- a/src/commands/list/json_v2.rs
+++ b/src/commands/list/json_v2.rs
@@ -31,7 +31,7 @@ use worktrunk::git::{
use super::ci_status::{CiSource, CiStatus, PrStatus, ReviewState};
use super::custom_columns::ResolvedCustomColumn;
use super::json_output::{JsonDiff, format_raw_symbols};
-use super::model::{ActiveGitOperation, BranchScope, Collected, ItemKind, ListItem, WorktreeData};
+use super::model::{BranchScope, Collected, ItemKind, ListItem, WorktreeData};
/// Tri-state field encoding the absence rule (see module docs).
#[derive(Debug, Clone, PartialEq)]
@@ -210,8 +210,8 @@ pub struct JsonWorktreeV2 {
/// created for.
pub branch_mismatch: bool,
- /// In-progress operation: `"rebase"` or `"merge"`; absent when none,
- /// null while unresolved.
+ /// In-progress operation: `"rebase"`, `"merge"`, `"cherry_pick"`,
+ /// `"revert"`, or `"bisect"`; absent when none, null while unresolved.
#[serde(skip_serializing_if = "Tri::is_absent")]
pub operation: Tri<&'static str>,
@@ -573,9 +573,8 @@ fn json_worktree(data: &WorktreeData) -> JsonWorktreeV2 {
let operation = match data.git_operation {
None => Tri::Unknown,
- Some(ActiveGitOperation::None) => Tri::Absent,
- Some(ActiveGitOperation::Rebase) => Tri::Known("rebase"),
- Some(ActiveGitOperation::Merge) => Tri::Known("merge"),
+ Some(None) => Tri::Absent,
+ Some(Some(operation)) => Tri::Known(operation.into()),
};
let changes = data.working_tree_status.map(|wt| JsonChanges {
@@ -763,6 +762,8 @@ mod tests {
use insta::assert_snapshot;
use super::*;
+ use worktrunk::git::InProgressOperation;
+
use crate::commands::list::ci_status::PrRef;
use crate::commands::list::model::{AheadBehind, SeededFacts, UpstreamStatus};
@@ -1205,14 +1206,19 @@ mod tests {
.is_some_and(|v| v.is_null())
);
+ // Every operation keeps its own name in JSON, including the three that
+ // share the `↻` symbol with rebase and merge.
for (op, expected) in [
- (ActiveGitOperation::Rebase, "rebase"),
- (ActiveGitOperation::Merge, "merge"),
+ (InProgressOperation::Rebase, "rebase"),
+ (InProgressOperation::Merge, "merge"),
+ (InProgressOperation::CherryPick, "cherry_pick"),
+ (InProgressOperation::Revert, "revert"),
+ (InProgressOperation::Bisect, "bisect"),
] {
let item = worktree_item(
"feature",
WorktreeData {
- git_operation: Some(op),
+ git_operation: Some(Some(op)),
..Default::default()
},
);
diff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rs
index 7aeb2695c..dcd0a73f4 100644
--- a/src/commands/list/layout.rs
+++ b/src/commands/list/layout.rs
@@ -1498,8 +1498,8 @@ mod tests {
#[test]
fn test_visible_columns_follow_gap_rule() {
use crate::commands::list::model::{
- ActiveGitOperation, AheadBehind, BranchDiffTotals, CommitDetails, ItemKind, ListItem,
- StatusSymbols, UpstreamStatus, WorktreeData,
+ AheadBehind, BranchDiffTotals, CommitDetails, ItemKind, ListItem, StatusSymbols,
+ UpstreamStatus, WorktreeData,
};
// Create test data with specific widths to verify position calculation
@@ -1549,7 +1549,7 @@ mod tests {
working_tree_status: None,
has_conflicts: None,
has_working_tree_conflicts: None,
- git_operation: Some(ActiveGitOperation::None),
+ git_operation: Some(None),
is_main: false,
is_current: false,
is_previous: false,
@@ -1619,8 +1619,8 @@ mod tests {
#[test]
fn test_column_positions_with_empty_columns() {
use crate::commands::list::model::{
- ActiveGitOperation, AheadBehind, BranchDiffTotals, CommitDetails, ItemKind, ListItem,
- StatusSymbols, UpstreamStatus, WorktreeData,
+ AheadBehind, BranchDiffTotals, CommitDetails, ItemKind, ListItem, StatusSymbols,
+ UpstreamStatus, WorktreeData,
};
// Create minimal data - most columns will be empty
@@ -1665,7 +1665,7 @@ mod tests {
working_tree_status: None,
has_conflicts: None,
has_working_tree_conflicts: None,
- git_operation: Some(ActiveGitOperation::None),
+ git_operation: Some(None),
is_main: true, // Primary worktree: no ahead/behind shown
is_current: false,
is_previous: false,
@@ -1759,9 +1759,7 @@ mod tests {
/// Helper: create a minimal ListItem for layout tests.
fn make_test_item(branch: &str) -> super::super::model::ListItem {
- use crate::commands::list::model::{
- ActiveGitOperation, ItemKind, StatusSymbols, WorktreeData,
- };
+ use crate::commands::list::model::{ItemKind, StatusSymbols, WorktreeData};
super::super::model::ListItem {
head: "abc12345".to_string(),
short_sha: "abc1234".to_string(),
@@ -1795,7 +1793,7 @@ mod tests {
working_tree_status: None,
has_conflicts: None,
has_working_tree_conflicts: None,
- git_operation: Some(ActiveGitOperation::None),
+ git_operation: Some(None),
is_main: false,
is_current: false,
is_previous: false,
@@ -2227,9 +2225,7 @@ mod tests {
/// Helper: create a test item with a specific worktree path and no mismatch.
fn make_test_item_at(branch: &str, path: &str) -> super::super::model::ListItem {
- use crate::commands::list::model::{
- ActiveGitOperation, ItemKind, StatusSymbols, WorktreeData,
- };
+ use crate::commands::list::model::{ItemKind, StatusSymbols, WorktreeData};
super::super::model::ListItem {
head: "abc12345".to_string(),
short_sha: "abc1234".to_string(),
@@ -2263,7 +2259,7 @@ mod tests {
working_tree_status: None,
has_conflicts: None,
has_working_tree_conflicts: None,
- git_operation: Some(ActiveGitOperation::None),
+ git_operation: Some(None),
is_main: false,
is_current: false,
is_previous: false,
@@ -2352,8 +2348,8 @@ mod tests {
#[test]
fn test_snapshot_path_yields_to_summary() {
use crate::commands::list::model::{
- ActiveGitOperation, AheadBehind, BranchDiffTotals, CommitDetails, ItemKind,
- StatusSymbols, UpstreamStatus, WorktreeData,
+ AheadBehind, BranchDiffTotals, CommitDetails, ItemKind, StatusSymbols, UpstreamStatus,
+ WorktreeData,
};
use worktrunk::git::LineDiff;
@@ -2419,7 +2415,7 @@ mod tests {
working_tree_status: None,
has_conflicts: None,
has_working_tree_conflicts: None,
- git_operation: Some(ActiveGitOperation::None),
+ git_operation: Some(None),
is_main,
is_current,
is_previous: false,
diff --git a/src/commands/list/model/item.rs b/src/commands/list/model/item.rs
index b4621034f..a1c223c19 100644
--- a/src/commands/list/model/item.rs
+++ b/src/commands/list/model/item.rs
@@ -6,9 +6,11 @@
use std::path::PathBuf;
use color_print::cformat;
-use worktrunk::git::{IntegrationReason, IntegrationSignals, LineDiff, check_integration};
+use worktrunk::git::{
+ InProgressOperation, IntegrationReason, IntegrationSignals, LineDiff, check_integration,
+};
-use super::state::{ActiveGitOperation, Divergence, MainState, OperationState, WorktreeState};
+use super::state::{Divergence, MainState, OperationState, WorktreeState};
use super::stats::{AheadBehind, BranchDiffTotals, CommitDetails, UpstreamStatus};
use super::status_symbols::{StatusSymbols, WorkingTreeStatus};
use crate::commands::list::ci_status::PrStatus;
@@ -52,10 +54,10 @@ pub struct WorktreeData {
/// was clean, so fall back to the committed-HEAD merge-tree check.
/// Outer `Some(Some(b))` = dirty working tree, `b` is the conflict result.
pub has_working_tree_conflicts: Option<Option<bool>>,
- /// Git operation in progress (rebase/merge). `None` = not yet loaded;
- /// `Some(ActiveGitOperation::None)` = loaded, no operation in progress.
+ /// Git operation in progress. Outer `None` = not yet loaded;
+ /// `Some(None)` = loaded, no operation in progress.
/// Fed by the `GitOperation` task.
- pub git_operation: Option<ActiveGitOperation>,
+ pub git_operation: Option<Option<InProgressOperation>>,
pub is_main: bool,
/// Whether this is the current worktree (matches repo discovery path: PWD or `-C`)
pub is_current: bool,
@@ -662,7 +664,7 @@ impl ListItem {
/// Gate 2: operation state. Resolves once both `has_conflicts` and
/// `git_operation` have reported. Priority within the gate:
- /// `has_conflicts` > rebase > merge > none.
+ /// `has_conflicts` > in-progress operation > none.
fn try_gate_operation_state(&self) -> Option<OperationState> {
match &self.kind {
ItemKind::Worktree(data) => {
@@ -670,12 +672,10 @@ impl ListItem {
if has_conflicts {
return Some(OperationState::Conflicts);
}
- let git_operation = data.git_operation.as_ref()?;
- match git_operation {
- ActiveGitOperation::Rebase => Some(OperationState::Rebase),
- ActiveGitOperation::Merge => Some(OperationState::Merge),
- ActiveGitOperation::None => Some(OperationState::None),
- }
+ Some(match data.git_operation? {
+ Some(operation) => OperationState::InProgress(operation),
+ None => OperationState::None,
+ })
}
// Branches have no operation state; trivially resolved to None.
ItemKind::Branch(_) => Some(OperationState::None),
@@ -1166,7 +1166,7 @@ mod tests {
#[test]
fn gate_operation_state_waits_for_both_inputs() {
// `has_conflicts = Some(false)` but `git_operation = None` →
- // gate stays Loading (could still become Rebase/Merge).
+ // gate stays Loading (an operation could still report).
let mut item = make_worktree_item();
if let ItemKind::Worktree(ref mut data) = item.kind {
data.has_conflicts = Some(false);
@@ -1177,12 +1177,12 @@ mod tests {
// Set git_operation → gate resolves.
if let ItemKind::Worktree(ref mut data) = item.kind {
- data.git_operation = Some(ActiveGitOperation::Rebase);
+ data.git_operation = Some(Some(InProgressOperation::Rebase));
}
item.refresh_status_symbols(None);
assert_eq!(
item.status_symbols.operation_state,
- Some(OperationState::Rebase)
+ Some(OperationState::InProgress(InProgressOperation::Rebase))
);
}
diff --git a/src/commands/list/model/mod.rs b/src/commands/list/model/mod.rs
index 0e805b086..b980d05e1 100644
--- a/src/commands/list/model/mod.rs
+++ b/src/commands/list/model/mod.rs
@@ -24,7 +24,7 @@ pub mod statusline_segment;
#[allow(unused_imports)]
pub use item::{BranchScope, Collected, ItemKind, ListData, ListItem, SeededFacts, WorktreeData};
#[allow(unused_imports)]
-pub use state::{ActiveGitOperation, Divergence, MainState, OperationState, WorktreeState};
+pub use state::{Divergence, MainState, OperationState, WorktreeState};
#[allow(unused_imports)]
pub use stats::{ActiveUpstream, AheadBehind, BranchDiffTotals, CommitDetails, UpstreamStatus};
#[allow(unused_imports)]
diff --git a/src/commands/list/model/state.rs b/src/commands/list/model/state.rs
index 5fc482382..5ea52bcec 100644
--- a/src/commands/list/model/state.rs
+++ b/src/commands/list/model/state.rs
@@ -3,7 +3,7 @@
//! These represent various states a worktree or branch can be in relative to
//! the default branch, upstream remote, or git operations in progress.
-use worktrunk::git::IntegrationReason;
+use worktrunk::git::{InProgressOperation, IntegrationReason};
/// Upstream divergence state relative to remote tracking branch.
///
@@ -410,20 +410,23 @@ pub fn tier_counts(
/// Represents blocking git operations in progress that require resolution.
/// These take priority over all other states in the Worktree column.
///
-/// Priority: Conflicts (✘) > Rebase (⤴) > Merge (⤵)
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, strum::IntoStaticStr)]
-#[strum(serialize_all = "snake_case")]
+/// Priority: Conflicts (✘) > InProgress (↻)
+///
+/// Every in-progress operation renders the same symbol. What the reader does
+/// about a stopped rebase, merge, cherry-pick, revert, or bisect is identical —
+/// run `git status`, then finish or abort it — so splitting the column across a
+/// glyph per operation asked the reader to distinguish states that lead to the
+/// same next step, and left the operations without a glyph invisible. The
+/// operation's identity is still carried, for `--format=json` to name.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum OperationState {
/// No operation in progress
#[default]
- #[strum(serialize = "")]
None,
/// Actual merge conflicts (unmerged paths in working tree)
Conflicts,
- /// Rebase in progress
- Rebase,
- /// Merge in progress
- Merge,
+ /// Git is partway through an operation of its own.
+ InProgress(InProgressOperation),
}
impl std::fmt::Display for OperationState {
@@ -431,8 +434,7 @@ impl std::fmt::Display for OperationState {
match self {
Self::None => Ok(()),
Self::Conflicts => write!(f, "✘"),
- Self::Rebase => write!(f, "⤴"),
- Self::Merge => write!(f, "⤵"),
+ Self::InProgress(_) => write!(f, "↻"),
}
}
}
@@ -442,38 +444,30 @@ impl OperationState {
///
/// Color semantics:
/// - ERROR (red): Conflicts - blocking problems
- /// - WARNING (yellow): Rebase, Merge - active/stuck states
+ /// - WARNING (yellow): InProgress - active/stuck states
pub fn styled(&self) -> Option<String> {
use color_print::cformat;
match self {
Self::None => None,
Self::Conflicts => Some(cformat!("<red>{self}</>")),
- Self::Rebase | Self::Merge => Some(cformat!("<yellow>{self}</>")),
+ Self::InProgress(_) => Some(cformat!("<yellow>{self}</>")),
}
}
/// Returns the JSON string representation.
+ ///
+ /// The symbol collapses every operation into one glyph; JSON keeps the
+ /// operation's own name, so a consumer can still tell a stopped bisect from
+ /// a stopped rebase.
pub fn as_json_str(self) -> Option<&'static str> {
- let s: &'static str = self.into();
- if s.is_empty() { None } else { Some(s) }
+ match self {
+ Self::None => None,
+ Self::Conflicts => Some("conflicts"),
+ Self::InProgress(operation) => Some(operation.into()),
+ }
}
}
-/// Active git operation in a worktree
-///
-/// Represents raw data about whether a worktree is in the middle of a git operation.
-/// This is distinct from [`OperationState`] which is the display enum (includes Conflicts,
-/// has symbols/colors).
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
-pub enum ActiveGitOperation {
- #[default]
- None,
- /// Rebase in progress (rebase-merge or rebase-apply directory exists)
- Rebase,
- /// Merge in progress (MERGE_HEAD exists)
- Merge,
-}
-
#[cfg(test)]
mod tests {
use super::*;
@@ -919,8 +913,16 @@ mod tests {
fn test_operation_state_display() {
assert_eq!(format!("{}", OperationState::None), "");
assert_eq!(format!("{}", OperationState::Conflicts), "✘");
- assert_eq!(format!("{}", OperationState::Rebase), "⤴");
- assert_eq!(format!("{}", OperationState::Merge), "⤵");
+ // Every operation renders the same glyph.
+ for operation in [
+ InProgressOperation::Rebase,
+ InProgressOperation::Merge,
+ InProgressOperation::CherryPick,
+ InProgressOperation::Revert,
+ InProgressOperation::Bisect,
+ ] {
+ assert_eq!(format!("{}", OperationState::InProgress(operation)), "↻");
+ }
}
#[test]
@@ -928,15 +930,30 @@ mod tests {
use insta::assert_snapshot;
assert!(OperationState::None.styled().is_none());
assert_snapshot!(OperationState::Conflicts.styled().unwrap(), @"✘");
- assert_snapshot!(OperationState::Rebase.styled().unwrap(), @"⤴");
- assert_snapshot!(OperationState::Merge.styled().unwrap(), @"⤵");
+ assert_snapshot!(
+ OperationState::InProgress(InProgressOperation::Rebase)
+ .styled()
+ .unwrap(),
+ @"↻"
+ );
}
#[test]
fn test_operation_state_as_json_str() {
assert_eq!(OperationState::None.as_json_str(), None);
assert_eq!(OperationState::Conflicts.as_json_str(), Some("conflicts"));
- assert_eq!(OperationState::Rebase.as_json_str(), Some("rebase"));
- assert_eq!(OperationState::Merge.as_json_str(), Some("merge"));
+ // The symbol is shared; the JSON name is not.
+ assert_eq!(
+ OperationState::InProgress(InProgressOperation::Rebase).as_json_str(),
+ Some("rebase")
+ );
+ assert_eq!(
+ OperationState::InProgress(InProgressOperation::CherryPick).as_json_str(),
+ Some("cherry_pick")
+ );
+ assert_eq!(
+ OperationState::InProgress(InProgressOperation::Bisect).as_json_str(),
+ Some("bisect")
+ );
}
}
diff --git a/src/commands/list/model/status_symbols.rs b/src/commands/list/model/status_symbols.rs
index b883a422e..c7ea5735a 100644
--- a/src/commands/list/model/status_symbols.rs
+++ b/src/commands/list/model/status_symbols.rs
@@ -22,7 +22,7 @@
//! | 0 | `STAGED` | `+` | Are there staged changes? |
//! | 1 | `MODIFIED` | `!` | Are there unstaged modifications? |
//! | 2 | `UNTRACKED` | `?` | Are there untracked files? |
-//! | 3 | `WORKTREE_STATE` | `✘ ⤴ ⤵ ⊟ ⊞ ⚑ /` | Operation / worktree attribute |
+//! | 3 | `WORKTREE_STATE` | `✘ ↻ ⊟ ⊞ ⚑ /` | Operation / worktree attribute |
//! | 4 | `MAIN_STATE` | `^ _ ⊂ ✗ – ↕ ↑ ↓` | Relationship to the default branch |
//! | 5 | `UPSTREAM_DIVERGENCE` | \| ⇅ ⇡ ⇣ | Relationship to the tracked remote |
//! | 6 | `USER_MARKER` | emoji / text | User-defined annotation |
@@ -55,8 +55,8 @@
//!
//! # Gate 2: Worktree state (position 3)
//!
-//! **Renders:** at most one of `✘ ⤴ ⤵ ⊟ ⊞ ⚑ /`, priority
-//! `✘ > ⤴ > ⤵ > ⊟ > ⊞ > ⚑ > /`. The operation family (`✘⤴⤵`) comes from live
+//! **Renders:** at most one of `✘ ↻ ⊟ ⊞ ⚑ /`, priority
+//! `✘ > ↻ > ⊟ > ⊞ > ⚑ > /`. The operation family (`✘↻`) comes from live
//! task data; the attribute family (`⊟⊞⚑/`) is metadata, always known.
//!
//! **Inputs:** `data.has_conflicts`, `data.git_operation`, plus metadata
@@ -68,14 +68,14 @@
//! row of the priority table is the answer:
//!
//! 1. `has_conflicts == Some(true)` → `✘`.
-//! 2. `has_conflicts == Some(false)` and `git_operation == Some(Rebase)` → `⤴`.
-//! 3. `has_conflicts == Some(false)` and `git_operation == Some(Merge)` → `⤵`.
-//! 4. `has_conflicts == Some(false)` and `git_operation == Some(None)` and
+//! 2. `has_conflicts == Some(false)` and `git_operation == Some(Some(_))` →
+//! `↻`, whichever operation it is.
+//! 3. `has_conflicts == Some(false)` and `git_operation == Some(None)` and
//! metadata says prunable → `⊟`.
-//! 5. …continuing down through `⊞`, `⚑`, `/`, nothing.
+//! 4. …continuing down through `⊞`, `⚑`, `/`, nothing.
//!
//! Until both `has_conflicts` and `git_operation` are known, we cannot rule
-//! out `✘/⤴/⤵`, so the position renders `·` even if metadata would otherwise
+//! out `✘/↻`, so the position renders `·` even if metadata would otherwise
//! produce `⊟` or `⊞`.
//!
//! **Exception — items with no working tree:** branches and prunable
@@ -264,7 +264,7 @@ impl PositionMask {
pub(crate) const STAGED: usize = 0; // + (staged changes)
pub(crate) const MODIFIED: usize = 1; // ! (modified files)
pub(crate) const UNTRACKED: usize = 2; // ? (untracked files)
- pub(crate) const WORKTREE_STATE: usize = 3; // Worktree: ✘⤴⤵/⚑⊟⊞
+ pub(crate) const WORKTREE_STATE: usize = 3; // Worktree: ✘↻/⚑⊟⊞
pub(crate) const MAIN_STATE: usize = 4; // Main relationship: ^_⊂✗↕↑↓
pub(crate) const UPSTREAM_DIVERGENCE: usize = 5; // Remote: |⇅⇡⇣
pub(crate) const USER_MARKER: usize = 6;
@@ -276,7 +276,7 @@ impl PositionMask {
1, // STAGED: + (1 char)
1, // MODIFIED: ! (1 char)
1, // UNTRACKED: ? (1 char)
- 1, // WORKTREE_STATE: ✘⤴⤵/⊟⊞⚑ (1 char, priority: conflicts > rebase > merge > prunable > locked > branch_worktree_mismatch > branch)
+ 1, // WORKTREE_STATE: ✘↻/⊟⊞⚑ (1 char, priority: conflicts > in-progress operation > prunable > locked > branch_worktree_mismatch > branch)
1, // MAIN_STATE: ^_⊂✗–↕↑↓ (1 char, priority: is_main > orphan > empty > integrated > would_conflict > same_commit > diverged > ahead > behind)
1, // UPSTREAM_DIVERGENCE: |⇡⇣⇅ (1 char)
2, // USER_MARKER: single emoji or two chars (allocate 2)
@@ -353,7 +353,7 @@ impl WorkingTreeStatus {
/// Symbols are categorized to enable vertical alignment in table output.
/// Display order (left to right):
/// - Working tree: +, !, ? (staged, modified, untracked - NOT mutually exclusive)
-/// - Worktree state: ✘, ⤴, ⤵, /, ⚑, ⊟, ⊞ (operations + location)
+/// - Worktree state: ✘, ↻, /, ⚑, ⊟, ⊞ (operations + location)
/// - Main state: ^, ✗, _, ⊂, ↕, ↑, ↓ (relationship to default branch - single-stroke vertical arrows)
/// - Upstream divergence: |, ⇅, ⇡, ⇣ (relationship to remote - vertical arrows)
/// - User marker: custom labels, emoji
@@ -361,10 +361,9 @@ impl WorkingTreeStatus {
/// ## Mutual Exclusivity
///
/// **Worktree state (operations take priority over location):**
-/// Priority: ✘ > ⤴ > ⤵ > ⊟ > ⊞ > ⚑ > /
+/// Priority: ✘ > ↻ > ⊟ > ⊞ > ⚑ > /
/// - ✘: Actual conflicts (must resolve)
-/// - ⤴: Rebase in progress
-/// - ⤵: Merge in progress
+/// - ↻: A git operation is in progress (rebase, merge, cherry-pick, revert, bisect)
/// - ⊟: Prunable (directory missing)
/// - ⊞: Locked worktree
/// - ⚑: Branch-worktree mismatch (informational, dim yellow)
@@ -398,7 +397,7 @@ pub struct StatusSymbols {
pub(crate) main_state: Option<MainState>,
/// Gate 2 output — operation family (position 3). `None` = loading (we
- /// can't rule out `✘⤴⤵`); `Some(OperationState::None)` = resolved to
+ /// can't rule out `✘↻`); `Some(OperationState::None)` = resolved to
/// nothing (fall through to `worktree_state`).
pub(crate) operation_state: Option<OperationState>,
@@ -547,7 +546,7 @@ impl StatusSymbols {
None => SlotState::Loading,
};
- // Gate 2 — worktree state (position 3). Operation family (`✘⤴⤵`)
+ // Gate 2 — worktree state (position 3). Operation family (`✘↻`)
// takes priority over metadata family (`⚑⊟⊞/`). The gate is
// `Loading` iff `operation_state` is still `None` — even when
// `worktree_state` metadata would yield `⊟`, we cannot safely show
@@ -615,6 +614,7 @@ pub(crate) enum SlotState {
#[cfg(test)]
mod tests {
use insta::assert_snapshot;
+ use worktrunk::git::InProgressOperation;
use super::*;
@@ -706,7 +706,7 @@ mod tests {
assert!(!is_empty(&symbols));
let symbols = StatusSymbols {
- operation_state: Some(OperationState::Rebase),
+ operation_state: Some(OperationState::InProgress(InProgressOperation::Rebase)),
..Default::default()
};
assert!(!is_empty(&symbols));
diff --git a/src/commands/step/squash.rs b/src/commands/step/squash.rs
index e06eb9803..b4b1a06d1 100644
--- a/src/commands/step/squash.rs
+++ b/src/commands/step/squash.rs
@@ -82,6 +82,17 @@ pub fn handle_squash(
let env = CommandEnv::for_action(config)?;
let repo = &env.repo;
+ // Rewriting history under a half-finished operation is never what the user
+ // meant, and mid-rebase HEAD is detached — so this runs ahead of the branch
+ // check, which would otherwise blame the detached HEAD and point at
+ // `git switch`, the one command that throws the operation away.
+ repo.ensure_no_operation_in_progress("squash")?;
+ // Squash auto-stages, and `git add -A` would resolve an unmerged path to
+ // whatever is on disk — conflict markers included. Refuse ahead of the
+ // hooks and the LLM call, neither of which is worth running for a squash
+ // that cannot happen.
+ repo.worktree_at(&env.worktree_path)
+ .ensure_no_unmerged_paths("squash")?;
// Squash requires being on a branch (can't squash in detached HEAD)
let current_branch = env.require_branch("squash")?.to_string();
let ctx = env.context(yes);
diff --git a/src/git/error.rs b/src/git/error.rs
index 0ee3261da..0bb158b19 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -414,6 +414,21 @@ pub enum GitError {
/// The action the user asked for ("merge", "rebase").
action: String,
},
+ /// The index still holds unresolved conflicts, so a command that stages on
+ /// the user's behalf (`wt step commit`, `wt step squash`) refuses to run.
+ ///
+ /// Offers no remedy for the same reason as
+ /// [`OperationInProgress`](Self::OperationInProgress) — resolving a
+ /// conflict is git's own workflow, and whatever left the conflict behind
+ /// names it better than a fixed line could. The paths are worth carrying:
+ /// they are the one thing the user needs and git isn't being asked.
+ UnmergedPaths {
+ /// The action the user asked for ("commit", "squash").
+ action: String,
+ /// Paths the index records as unmerged, one per line in the gutter.
+ /// Never empty — an empty set is not an error.
+ files: Vec<String>,
+ },
UncommittedChanges {
action: Option<String>,
/// Branch name (for multi-worktree operations)
@@ -645,6 +660,12 @@ impl GitError {
cformat!("Cannot {action}: a git operation is already in progress")
}
+ GitError::UnmergedPaths { action, files } => {
+ let count = files.len();
+ let paths = if count == 1 { "path" } else { "paths" };
+ cformat!("Cannot {action}: {count} {paths} with unresolved conflicts")
+ }
+
GitError::UncommittedChanges { action, branch, .. } => match (action, branch) {
(Some(action), Some(b)) => {
cformat!("Cannot {action}: <bold>{b}</> has uncommitted changes")
@@ -881,6 +902,12 @@ impl GitError {
write!(f, "{}", error_message(&title))
}
+ GitError::UnmergedPaths { files, .. } => {
+ let title = self.title();
+ write!(f, "{}", error_message(&title))?;
+ write!(f, "\n{}", format_with_gutter(&files.join("\n"), None))
+ }
+
GitError::UncommittedChanges {
branch,
force_hint,
diff --git a/src/git/repository/working_tree.rs b/src/git/repository/working_tree.rs
index 23d08b93a..18e8b6712 100644
--- a/src/git/repository/working_tree.rs
+++ b/src/git/repository/working_tree.rs
@@ -34,8 +34,10 @@ fn has_initialized_submodules_from_status(status: &str) -> bool {
/// for, so a table here would only be a second copy to keep current with git.
///
/// Structured rather than a display string so [`Rebase`](Self::Rebase) can be
-/// recognized without matching on user-visible text.
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+/// recognized without matching on user-visible text. The `strum` name is the
+/// `wt list --format=json` value for the operation.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, strum::IntoStaticStr)]
+#[strum(serialize_all = "snake_case")]
pub enum InProgressOperation {
Merge,
/// Rebase, from either backend. `git am` shares the am backend's
@@ -488,6 +490,46 @@ impl<'a> WorkingTree<'a> {
Ok(None)
}
+ /// Paths the index still records as unmerged.
+ ///
+ /// A conflict git could not resolve leaves the path at stages 1–3 of the
+ /// index, which is what makes `git commit` refuse. Reading the index
+ /// rather than the state files answers a different question from
+ /// [`operation_in_progress`](Self::operation_in_progress): a conflicted
+ /// `git stash pop` leaves unmerged paths behind with no operation open at
+ /// all.
+ pub fn unmerged_paths(&self) -> anyhow::Result<Vec<String>> {
+ let output = self
+ .run_command(&["diff", "--name-only", "--diff-filter=U", "-z"])
+ .context("Failed to list unmerged paths")?;
+ Ok(output
+ .split('\0')
+ .filter(|path| !path.is_empty())
+ .map(str::to_string)
+ .collect())
+ }
+
+ /// Fail when the index still holds unresolved conflicts.
+ ///
+ /// A precondition for the commands that stage on the user's behalf
+ /// (`wt step commit`, `wt step squash`). `git add -A` collapses an
+ /// unmerged path's three stages into one entry, so it resolves the
+ /// conflict as far as the index is concerned while the file on disk still
+ /// holds `<<<<<<<` markers — and it takes git's own refusal to commit
+ /// with it. Asking before staging is what keeps the markers out of a
+ /// commit.
+ pub fn ensure_no_unmerged_paths(&self, action: &str) -> anyhow::Result<()> {
+ let files = self.unmerged_paths()?;
+ if files.is_empty() {
+ return Ok(());
+ }
+ Err(crate::git::GitError::UnmergedPaths {
+ action: action.to_string(),
+ files,
+ }
+ .into())
+ }
+
/// Check if this is a linked worktree (vs the main worktree).
///
/// Returns `true` for linked worktrees (created via `git worktree add`),
diff --git a/src/md_help.rs b/src/md_help.rs
index 501909a14..6f07f7efe 100644
--- a/src/md_help.rs
+++ b/src/md_help.rs
@@ -482,8 +482,7 @@ fn colorize_status_symbols(text: &str) -> String {
result = replace_dim(result, "✘", error);
// Git operations, MergeTreeConflicts: WARNING (yellow)
- result = replace_dim(result, "⤴", warning);
- result = replace_dim(result, "⤵", warning);
+ result = replace_dim(result, "↻", warning);
result = replace_dim(result, "✗", warning);
// Worktree state: Prunable/Locked (yellow), BranchWorktreeMismatch (dim yellow)
@@ -780,8 +779,8 @@ mod tests {
assert_snapshot!(conflicts, @"✘ conflicts");
// Git operations → yellow
- let git_ops = colorize_status_symbols(&format!("{dim}⤴{dim:#} rebase"));
- assert_snapshot!(git_ops, @"⤴ rebase");
+ let git_ops = colorize_status_symbols(&format!("{dim}↻{dim:#} rebase"));
+ assert_snapshot!(git_ops, @"↻ rebase");
// CI legend samples: dimmed `#` + color name recolors the sample
let ci_passed = colorize_status_symbols(&format!("{dim}#{dim:#} green"));
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index 478c1bcfd..2e308a70c 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -1074,6 +1074,30 @@ fn test_list_json_with_git_operation(mut repo: TestRepo) {
});
}
+/// A bisect is the plainest of the operations that had no symbol of their own
+/// before every operation folded into `↻`: it leaves HEAD on the branch and the
+/// working tree clean, so nothing else in the Status cell stands in for it.
+/// JSON still names the operation the symbol no longer distinguishes.
+#[rstest]
+fn test_list_shows_symbol_for_bisect(mut repo: TestRepo) {
+ let feature = repo.add_worktree("bisecting");
+ repo.git_command()
+ .current_dir(&feature)
+ .args(["bisect", "start"])
+ .run()
+ .unwrap();
+
+ assert_cmd_snapshot!(
+ "list_bisect_symbol",
+ list_snapshots::command(&repo, repo.root_path())
+ );
+ assert_cmd_snapshot!("list_bisect_json", {
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--format=json");
+ cmd
+ });
+}
+
#[rstest]
fn test_list_branch_only_with_status(repo: TestRepo) {
// Test that branch-only entries (no worktree) can display branch-keyed status
@@ -3026,8 +3050,8 @@ fn test_list_maximum_working_tree_symbols(mut repo: TestRepo) {
#[rstest]
fn test_list_maximum_status_with_git_operation(mut repo: TestRepo) {
- // Test maximum status symbols including git operation (rebase/merge):
- // ?!+ (working_tree) + = (conflicts) + ↻ (rebase) + ↕ (diverged) + ⊠ (locked) + 🤖 (user marker)
+ // Test maximum status symbols including an in-progress git operation:
+ // ?!+ (working_tree) + = (conflicts) + ↻ (operation) + ↕ (diverged) + ⊠ (locked) + 🤖 (user marker)
// This pushes the Status column to ~10-11 chars of actual content
// Create initial commit with a file that will conflict
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index 466d5d6a3..d3ea8072b 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -3518,6 +3518,77 @@ fn test_merge_refuses_mid_merge(mut repo: TestRepo) {
);
}
+/// Leave `feature` holding an unmerged path with *no* operation open. A
+/// conflicted `git stash pop` is the plainest way there: it leaves the index
+/// conflicted and writes no state file, so the operation check cannot see it
+/// and only the index knows.
+fn stop_feature_on_conflicted_stash_pop(repo: &mut TestRepo) -> PathBuf {
+ let feature_wt = repo.add_worktree("feature");
+ repo.commit_in_worktree(&feature_wt, "conflict.txt", "base\n", "Base edit");
+
+ let git = |repo: &TestRepo, args: &[&str]| {
+ repo.git_command()
+ .current_dir(&feature_wt)
+ .args(args.iter().copied())
+ .run()
+ .unwrap();
+ };
+ fs::write(feature_wt.join("conflict.txt"), "stashed\n").unwrap();
+ git(repo, &["stash"]);
+ fs::write(feature_wt.join("conflict.txt"), "committed\n").unwrap();
+ git(repo, &["commit", "-am", "Conflicting edit"]);
+ // Pops onto a line the commit already changed, so the merge fails.
+ git(repo, &["stash", "pop"]);
+
+ assert!(
+ !worktree_git_dir(repo, &feature_wt)
+ .join("MERGE_HEAD")
+ .exists(),
+ "a conflicted stash pop should leave no operation state behind"
+ );
+
+ feature_wt
+}
+
+/// `wt step squash` rewrites history, so an operation already replaying commits
+/// blocks it for the same reason it blocks `wt merge` — and mid-rebase the
+/// detached HEAD would otherwise get blamed, pointing at `git switch`.
+#[rstest]
+fn test_step_squash_refuses_mid_merge(mut repo: TestRepo) {
+ let feature_wt = stop_feature_mid_merge(&mut repo);
+ let head_before = repo.head_sha_in(&feature_wt);
+
+ assert_cmd_snapshot!(
+ "step_squash_refuses_mid_merge",
+ make_snapshot_cmd(&repo, "step", &["squash", "--yes"], Some(&feature_wt))
+ );
+ assert_eq!(
+ repo.head_sha_in(&feature_wt),
+ head_before,
+ "the refusal must leave HEAD alone; squashing here would commit the conflict markers"
+ );
+}
+
+/// The index is the authority on conflicts, not the state files: `wt step
+/// commit` stages on the user's behalf, and `git add -A` would resolve an
+/// unmerged path to whatever is on disk — conflict markers included — taking
+/// git's own refusal to commit with it.
+#[rstest]
+fn test_step_commit_refuses_unmerged_paths(mut repo: TestRepo) {
+ let feature_wt = stop_feature_on_conflicted_stash_pop(&mut repo);
+ let head_before = repo.head_sha_in(&feature_wt);
+
+ assert_cmd_snapshot!(
+ "step_commit_refuses_unmerged_paths",
+ make_snapshot_cmd(&repo, "step", &["commit", "--yes"], Some(&feature_wt))
+ );
+ assert_eq!(
+ repo.head_sha_in(&feature_wt),
+ head_before,
+ "the refusal must leave HEAD alone; committing here would commit the conflict markers"
+ );
+}
+
// =============================================================================
// JSON output tests
// =============================================================================
diff --git a/tests/snapshots/integration__integration_tests__help__help_list_long.snap b/tests/snapshots/integration__integration_tests__help__help_list_long.snap
index 4583df265..2dabb4feb 100644
--- a/tests/snapshots/integration__integration_tests__help__help_list_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_list_long.snap
@@ -219,17 +219,16 @@ Independent flags from git status; several can show at once (e.g. +!
Worktree
-An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (✘ > ⤴ > ⤵ > ⊟ > ⊞ > ⚑ > /):
-
- Symbol JSON Meaning
- ────── ───────────────────────────────────────── ──────────────────────────────────────────────
- ✘ operation_state "conflicts" Merge conflicts
- ⤴ operation_state "rebase" Rebase in progress
- ⤵ operation_state "merge" Merge in progress
- ⊟ worktree.state "prunable" Prunable (worktree directory missing)
- ⊞ worktree.state "locked" Locked worktree
- ⚑ worktree.state "branch_worktree_mismatch" Branch name doesn't match the worktree path
- / kind "branch" Branch without a worktree (no worktree object)
+An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (✘ > ↻ > ⊟ > ⊞ > ⚑ > /):
+
+ Symbol JSON Meaning
+ ────── ──────────────────────────────────────────────────────────────────── ───────────────────────────────────────────────────
+ ✘ operation_state "conflicts" Merge conflicts
+ ↻ operation_state "rebase", "merge", "cherry_pick", "revert", "bisect" A git operation is in progress; git status names it
+ ⊟ worktree.state "prunable" Prunable (worktree directory missing)
+ ⊞ worktree.state "locked" Locked worktree
+ ⚑ worktree.state "branch_worktree_mismatch" Branch name doesn't match the worktree path
+ / kind "branch" Branch without a worktree (no worktree object)
Default branch
diff --git a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
index 3732de997..cda40fa15 100644
--- a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
@@ -269,20 +269,20 @@ maps to a boolean in the working_tree object:
Worktree
An in-progress git operation, a worktree-location attribute, or a branch with no
- worktree. One symbol shows, highest priority first (✘ > ⤴ > ⤵ > ⊟ > ⊞ > ⚑ > /):
-
- Symbol JSON Meaning
- ────── ───────────────────────────────────────── ─────────────────────────────
- ✘ operation_state "conflicts" Merge conflicts
- ⤴ operation_state "rebase" Rebase in progress
- ⤵ operation_state "merge" Merge in progress
- ⊟ worktree.state "prunable" Prunable (worktree directory
- missing)
- ⊞ worktree.state "locked" Locked worktree
- ⚑ worktree.state "branch_worktree_mismatch" Branch name doesn't match the
- worktree path
- / kind "branch" Branch without a worktree (no
- worktree object)
+ worktree. One symbol shows, highest priority first (✘ > ↻ > ⊟ > ⊞ > ⚑ > /):
+
+ Symbol JSON Meaning
+ ────── ───────────────────────────── ─────────────────────────────────────────
+ ✘ operation_state "conflicts" Merge conflicts
+ ↻ operation_state "rebase", A git operation is in progress;
+ "merge", "cherry_pick", git status names it
+ "revert", "bisect"
+ ⊟ worktree.state "prunable" Prunable (worktree directory missing)
+ ⊞ worktree.state "locked" Locked worktree
+ ⚑ worktree.state Branch name doesn't match the worktree
+ "branch_worktree_mismatch" path
+ / kind "branch" Branch without a worktree (no worktree
+ object)
Default branch
diff --git a/tests/snapshots/integration__integration_tests__list__list_bisect_json.snap b/tests/snapshots/integration__integration_tests__list__list_bisect_json.snap
new file mode 100644
index 000000000..e3a7e9b09
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__list__list_bisect_json.snap
@@ -0,0 +1,248 @@
+---
+source: tests/integration_tests/list.rs
+info:
+ program: wt
+ args:
+ - list
+ - "--format=json"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+[
+ {
+ "branch": "main",
+ "path": "_REPO_",
+ "kind": "worktree",
+ "commit": {
+ "sha": "05a4a45d0b981dad5c27db59dca482836d59f89e",
+ "short_sha": "05a4a45",
+ "message": "Initial commit",
+ "timestamp": 1735718400
+ },
+ "working_tree": {
+ "staged": false,
+ "modified": false,
+ "untracked": false,
+ "renamed": false,
+ "deleted": false,
+ "diff": {
+ "added": 0,
+ "deleted": 0
+ }
+ },
+ "main_state": "is_main",
+ "remote": {
+ "name": "origin",
+ "branch": "main",
+ "ahead": 0,
+ "behind": 0
+ },
+ "worktree": {
+ "detached": false
+ },
+ "is_main": true,
+ "is_current": true,
+ "is_previous": false,
+ "statusline": "main \u001b[2m^\u001b[22m\u001b[2m|\u001b[22m",
+ "symbols": "^|"
+ },
+ {
+ "branch": "bisecting",
+ "path": "_REPO_.bisecting",
+ "kind": "worktree",
+ "commit": {
+ "sha": "05a4a45d0b981dad5c27db59dca482836d59f89e",
+ "short_sha": "05a4a45",
+ "message": "Initial commit",
+ "timestamp": 1735718400
+ },
+ "working_tree": {
+ "staged": false,
+ "modified": false,
+ "untracked": false,
+ "renamed": false,
+ "deleted": false,
+ "diff": {
+ "added": 0,
+ "deleted": 0
+ }
+ },
+ "main_state": "empty",
+ "operation_state": "bisect",
+ "main": {
+ "ahead": 0,
+ "behind": 0,
+ "diff": {
+ "added": 0,
+ "deleted": 0
+ }
+ },
+ "worktree": {
+ "detached": false
+ },
+ "is_main": false,
+ "is_current": false,
+ "is_previous": false,
+ "statusline": "bisecting \u001b[33m↻\u001b[39m\u001b[2m_\u001b[22m",
+ "symbols": "_↻"
+ },
+ {
+ "branch": "feature-a",
+ "path": "_REPO_.feature-a",
+ "kind": "worktree",
+ "commit": {
+ "sha": "1b87d4731ea707905d15a726e193531c20affa14",
+ "short_sha": "1b87d47",
+ "message": "Add feature-a file",
+ "timestamp": 1735718400
+ },
+ "working_tree": {
+ "staged": false,
+ "modified": false,
+ "untracked": false,
+ "renamed": false,
+ "deleted": false,
+ "diff": {
+ "added": 0,
+ "deleted": 0
+ }
+ },
+ "main_state": "ahead",
+ "main": {
+ "ahead": 1,
+ "behind": 0,
+ "diff": {
+ "added": 1,
+ "deleted": 0
+ }
+ },
+ "worktree": {
+ "detached": false
+ },
+ "is_main": false,
+ "is_current": false,
+ "is_previous": false,
+ "statusline": "feature-a \u001b[2m↑\u001b[22m \u001b[32m↑1\u001b[0m ^\u001b[32m+1\u001b[0m",
+ "symbols": "↑"
+ },
+ {
+ "branch": "feature-b",
+ "path": "_REPO_.feature-b",
+ "kind": "worktree",
+ "commit": {
+ "sha": "f62940fcec424585adf98625e722fdf990810614",
+ "short_sha": "f62940f",
+ "message": "Add feature-b file",
+ "timestamp": 1735718400
+ },
+ "working_tree": {
+ "staged": false,
+ "modified": false,
+ "untracked": false,
+ "renamed": false,
+ "deleted": false,
+ "diff": {
+ "added": 0,
+ "deleted": 0
+ }
+ },
+ "main_state": "ahead",
+ "main": {
+ "ahead": 1,
+ "behind": 0,
+ "diff": {
+ "added": 1,
+ "deleted": 0
+ }
+ },
+ "worktree": {
+ "detached": false
+ },
+ "is_main": false,
+ "is_current": false,
+ "is_previous": false,
+ "statusline": "feature-b \u001b[2m↑\u001b[22m \u001b[32m↑1\u001b[0m ^\u001b[32m+1\u001b[0m",
+ "symbols": "↑"
+ },
+ {
+ "branch": "feature-c",
+ "path": "_REPO_.feature-c",
+ "kind": "worktree",
+ "commit": {
+ "sha": "345c7c93ad7c3d8f5b08380898d78e024019599c",
+ "short_sha": "345c7c9",
+ "message": "Add feature-c file",
+ "timestamp": 1735718400
+ },
+ "working_tree": {
+ "staged": false,
+ "modified": false,
+ "untracked": false,
+ "renamed": false,
+ "deleted": false,
+ "diff": {
+ "added": 0,
+ "deleted": 0
+ }
+ },
+ "main_state": "ahead",
+ "main": {
+ "ahead": 1,
+ "behind": 0,
+ "diff": {
+ "added": 1,
+ "deleted": 0
+ }
+ },
+ "worktree": {
+ "detached": false
+ },
+ "is_main": false,
+ "is_current": false,
+ "is_previous": false,
+ "statusline": "feature-c \u001b[2m↑\u001b[22m \u001b[32m↑1\u001b[0m ^\u001b[32m+1\u001b[0m",
+ "symbols": "↑"
+ }
+]
+
+----- stderr -----
+▲ JSON output is schema 1; a future release switches the default to schema 2
+↳ To keep this format set [list] json-schema = 1; to adopt the new schema, set json-schema = 2
diff --git a/tests/snapshots/integration__integration_tests__list__list_bisect_symbol.snap b/tests/snapshots/integration__integration_tests__list__list_bisect_symbol.snap
new file mode 100644
index 000000000..78084efb6
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__list__list_bisect_symbol.snap
@@ -0,0 +1,57 @@
+---
+source: tests/integration_tests/list.rs
+info:
+ program: wt
+ args:
+ - list
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+ Branch Status HEAD± main↕ main…± Remote⇅ Path Commit Age Message
+@ main ^| | . 05a4a45d 16h Initial commit
++ bisecting ↻_ ../repo.bisecting 05a4a45d 16h Initial commit
++ feature-a ↑ ↑1 +1 ../repo.feature-a 1b87d473 16h Add feature-a file
++ feature-b ↑ ↑1 +1 ../repo.feature-b f62940fc 16h Add feature-b file
++ feature-c ↑ ↑1 +1 ../repo.feature-c 345c7c93 16h Add feature-c file
+
+----- stderr -----
+
+○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_refuses_unmerged_paths.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_refuses_unmerged_paths.snap
new file mode 100644
index 000000000..ac3bfc27e
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_refuses_unmerged_paths.snap
@@ -0,0 +1,53 @@
+---
+source: tests/integration_tests/merge.rs
+info:
+ program: wt
+ args:
+ - step
+ - commit
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✗ Cannot commit: 1 path with unresolved conflicts
+  conflict.txt
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_refuses_mid_merge.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_refuses_mid_merge.snap
new file mode 100644
index 000000000..9c1a69aee
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_refuses_mid_merge.snap
@@ -0,0 +1,52 @@
+---
+source: tests/integration_tests/merge.rs
+info:
+ program: wt
+ args:
+ - step
+ - squash
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✗ Cannot squash: a git operation is already in progress