Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat: Use ║ symbol to indicate "in sync" with remote
Maximilian Roos85a7b2a32ae4
diff --git a/README.md b/README.mdindex f2cc9b98d..a0138d04c 100644--- a/README.md+++ b/README.md@@ -64,7 +64,7 @@ merge, cleanup.```console$ wt listBranch Status HEAD± main↕ Path Remote⇅ Commit Age Message-@ main ^ ./repo ⇡0 ⇣0 b834638e 1d Initial commit+@ main ^║ ./repo ║ b834638e 1d Initial commit+ feature-x + ↑ +5 ↑3 ./repo.feature-x 6bba16d6 1h Add file 3+ bugfix-y ↑ ↑1 ./repo.bugfix-y bafa4cbd 2h Fix bugdiff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rsindex 87aee0e99..174d4bcb2 100644--- a/src/commands/list/layout.rs+++ b/src/commands/list/layout.rs@@ -299,7 +299,7 @@ impl ColumnKind {variant: DiffVariant::UpstreamArrows,positive_style: ADDITION,negative_style: DELETION.dimmed(),- always_show_zeros: true,+ always_show_zeros: false, // 0/0 case handled specially with ║ symbol}),_ => None,}diff --git a/src/commands/list/model.rs b/src/commands/list/model.rsindex fbe8a69d0..93d48a2db 100644--- a/src/commands/list/model.rs+++ b/src/commands/list/model.rs@@ -155,9 +155,10 @@ impl AheadBehind {upstream: &UpstreamStatus,) -> (MainDivergence, UpstreamDivergence) {let main_divergence = MainDivergence::from_counts(self.ahead, self.behind);- let (upstream_ahead, upstream_behind) =- upstream.active().map(|(_, a, b)| (a, b)).unwrap_or((0, 0));- let upstream_divergence = UpstreamDivergence::from_counts(upstream_ahead, upstream_behind);+ let upstream_divergence = match upstream.active() {+ None => UpstreamDivergence::None,+ Some((_, ahead, behind)) => UpstreamDivergence::from_counts_with_remote(ahead, behind),+ };(main_divergence, upstream_divergence)}@@ -643,9 +644,11 @@ impl MainDivergence {#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, strum::IntoStaticStr)]pub enum UpstreamDivergence {#[strum(serialize = "")]- /// Up to date with remote+ /// No remote tracking branch configured#[default]None,+ /// In sync with remote (has remote, 0 ahead, 0 behind)+ InSync,/// Ahead of remote (has commits remote doesn't have)Ahead,/// Behind remote (missing commits from remote)@@ -658,6 +661,7 @@ impl std::fmt::Display for UpstreamDivergence {fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {match self {Self::None => Ok(()),+ Self::InSync => write!(f, "║"),Self::Ahead => write!(f, "⇡"),Self::Behind => write!(f, "⇣"),Self::Diverged => write!(f, "⇅"),@@ -676,10 +680,13 @@ impl serde::Serialize for UpstreamDivergence {}impl UpstreamDivergence {- /// Compute divergence state from ahead/behind counts.- pub fn from_counts(ahead: usize, behind: usize) -> Self {+ /// Compute divergence state from ahead/behind counts when a remote exists.+ ///+ /// Returns `InSync` for 0/0 since we know a remote tracking branch exists.+ /// For cases where there's no remote, use `UpstreamDivergence::None` directly.+ pub fn from_counts_with_remote(ahead: usize, behind: usize) -> Self {match (ahead, behind) {- (0, 0) => Self::None,+ (0, 0) => Self::InSync,(_, 0) => Self::Ahead,(0, _) => Self::Behind,_ => Self::Diverged,diff --git a/src/commands/list/render.rs b/src/commands/list/render.rsindex 5c90d6194..53247fc8d 100644--- a/src/commands/list/render.rs+++ b/src/commands/list/render.rs@@ -609,6 +609,17 @@ impl ColumnLayout {let Some((_, ahead, behind)) = ctx.upstream.active() else {return StyledLine::new();};+ // Show centered ║ when in sync instead of ⇡0 ⇣0+ // Note: This duplicates the InSync check from UpstreamDivergence, but+ // checking counts directly is simpler than threading the enum through.+ if ahead == 0 && behind == 0 {+ let mut cell = StyledLine::new();+ // Center the symbol in the column width+ let padding_left = (self.width.saturating_sub(1)) / 2;+ cell.push_raw(" ".repeat(padding_left));+ cell.push_styled("║", Style::new().dimmed());+ return cell;+ }self.render_diff_cell(ahead, behind)}ColumnKind::Time => {diff --git a/tests/snapshots/integration__integration_tests__list__maximum_status_symbols.snap b/tests/snapshots/integration__integration_tests__list__maximum_status_symbols.snapindex 80b187272..bbfcc2549 100644--- a/tests/snapshots/integration__integration_tests__list__maximum_status_symbols.snap+++ b/tests/snapshots/integration__integration_tests__list__maximum_status_symbols.snap@@ -25,7 +25,7 @@ exit_code: 0----- stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage[0m-@ [1mmain[0m [2m^[22m[2m⇡[22m [1m./repo[0m [32m⇡1[0m [2m[31m⇣0[0m [2m85ed6d3d[0m [2m1d[0m [2mMain advances[0m+@ [1mmain[0m [2m^[22m[2m⇡[22m [1m./repo[0m [32m⇡1[0m [2m85ed6d3d[0m [2m1d[0m [2mMain advances[0m+ feature [36m+[39m[36m![39m[36m?[39m[33m⊘[39m[2m↕[22m[2m⇅[22m[33m⊠[39m🤖 [32m+2[0m [31m-2[0m [32m↑2[0m [2m[31m↓1[0m [32m+3[0m [31m-1[0m ./repo.feature [32m⇡1[0m [2m[31m⇣1[0m [2m4afb2b9e[0m [2m1d[0m [2mLocal commit[0m⚪ [2mShowing 2 worktrees, 1 with changes, 1 ahead[0mdiff --git a/tests/snapshots/integration__integration_tests__list__readme_example_simple_list.snap b/tests/snapshots/integration__integration_tests__list__readme_example_simple_list.snapindex 1d2d930ac..b299b4bb2 100644--- a/tests/snapshots/integration__integration_tests__list__readme_example_simple_list.snap+++ b/tests/snapshots/integration__integration_tests__list__readme_example_simple_list.snap@@ -24,7 +24,7 @@ exit_code: 0----- stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage[0m-@ [1mmain[0m [2m^[22m [1m./repo[0m [32m⇡0[0m [2m[31m⇣0[0m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m+@ [1mmain[0m [2m^[22m[2m║[22m [1m./repo[0m [2m║[0m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m+ feature-x [36m+[39m [2m↑[22m [32m+5[0m [32m↑3[0m ./repo.feature-x [2m6bba16d6[0m [2m1h[0m [2mAdd file 3[0m+ bugfix-y [2m↑[22m [32m↑1[0m ./repo.bugfix-y [2mbafa4cbd[0m [2m2h[0m [2mFix bug[0mdiff --git a/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snap b/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snapindex 0d2155cde..33de62c38 100644--- a/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snap+++ b/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snap@@ -26,8 +26,8 @@ exit_code: 0----- stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage[0m-@ [1mmain[0m [2m^[22m [1m./repo[0m [32m⇡0[0m [2m[31m⇣0[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m-+ ahead [2m↑[22m[2m⇡[22m [32m↑1[0m [32m+1[0m ./repo.ahead [32m⇡1[0m [2m[31m⇣0[0m [2m2fff52c2[0m [2m1d[0m [2mAhead commit[0m-+ [2min-sync[0m [2m_[22m [2m./repo.in-sync[0m [32m⇡0[0m [2m[31m⇣0[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m+@ [1mmain[0m [2m^[22m[2m║[22m [1m./repo[0m [2m║[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m++ ahead [2m↑[22m[2m⇡[22m [32m↑1[0m [32m+1[0m ./repo.ahead [32m⇡1[0m [2m2fff52c2[0m [2m1d[0m [2mAhead commit[0m++ [2min-sync[0m [2m_[22m [2m║[22m [2m./repo.in-sync[0m [2m║[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m⚪ [2mShowing 3 worktrees, 1 ahead[0mdiff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap b/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snapindex 971299a0a..cc352a7e4 100644--- a/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap+++ b/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap@@ -26,7 +26,7 @@ exit_code: 0----- stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage[0m-@ [1mmain[0m [2m^[22m [1m.[0m [32m⇡0[0m [2m[31m⇣0[0m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m+@ [1mmain[0m [2m^[22m[2m║[22m [1m.[0m [2m║[0m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m[2mlocal-only-1[0m [2m_[22m [2m⎇[22m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m[2mlocal-only-2[0m [2m_[22m [2m⎇[22m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m[2morigin/remote-only-1[0m [2m_[22m [2m⎇[22m [2mb834638e[0m [2m1d[0m [2mInitial commit[0mdiff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snap b/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snapindex ba91c1847..ce410ef77 100644--- a/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snap+++ b/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snap@@ -25,7 +25,7 @@ exit_code: 0----- stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage[0m-@ [1mmain[0m [2m^[22m [1m./repo[0m [32m⇡0[0m [2m[31m⇣0[0m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m+@ [1mmain[0m [2m^[22m[2m║[22m [1m./repo[0m [2m║[0m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m+ [2mfeature-with-worktree[0m [2m_[22m [2m./repo.feature-with-worktree[0m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m[2morigin/remote-only[0m [2m_[22m [2m⎇[22m [2mb834638e[0m [2m1d[0m [2mInitial commit[0mdiff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap b/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snapindex b4d2a06f5..5eef1a59e 100644--- a/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap+++ b/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap@@ -25,7 +25,7 @@ exit_code: 0----- stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage[0m-@ [1mmain[0m [2m^[22m [1m.[0m [32m⇡0[0m [2m[31m⇣0[0m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m+@ [1mmain[0m [2m^[22m[2m║[22m [1m.[0m [2m║[0m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m[2morigin/remote-feature-1[0m [2m_[22m [2m⎇[22m [2mb834638e[0m [2m1d[0m [2mInitial commit[0m[2morigin/remote-feature-2[0m [2m_[22m [2m⎇[22m [2mb834638e[0m [2m1d[0m [2mInitial commit[0mdiff --git a/tests/snapshots/integration__integration_tests__list__with_upstream_tracking.snap b/tests/snapshots/integration__integration_tests__list__with_upstream_tracking.snapindex 1e23e173f..48524e78a 100644--- a/tests/snapshots/integration__integration_tests__list__with_upstream_tracking.snap+++ b/tests/snapshots/integration__integration_tests__list__with_upstream_tracking.snap@@ -27,11 +27,11 @@ exit_code: 0----- stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage[0m-@ [1mmain[0m [2m^[22m [1m./repo[0m [32m⇡0[0m [2m[31m⇣0[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m-+ ahead [2m↑[22m[2m⇡[22m [32m↑2[0m [32m+2[0m ./repo.ahead [32m⇡2[0m [2m[31m⇣0[0m [2m8d8f4673[0m [2m1d[0m [2mAhead commit 2[0m-+ [2mbehind[0m [2m_[22m [2m⇣[22m [2m./repo.behind[0m [32m⇡0[0m [2m[31m⇣1[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m+@ [1mmain[0m [2m^[22m[2m║[22m [1m./repo[0m [2m║[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m++ ahead [2m↑[22m[2m⇡[22m [32m↑2[0m [32m+2[0m ./repo.ahead [32m⇡2[0m [2m8d8f4673[0m [2m1d[0m [2mAhead commit 2[0m++ [2mbehind[0m [2m_[22m [2m⇣[22m [2m./repo.behind[0m [2m[31m⇣1[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m+ diverged [2m↑[22m[2m⇅[22m [32m↑1[0m [32m+1[0m ./repo.diverged [32m⇡1[0m [2m[31m⇣1[0m [2mca7cb696[0m [2m1d[0m [2mDiverged local commit[0m-+ [2min-sync[0m [2m_[22m [2m./repo.in-sync[0m [32m⇡0[0m [2m[31m⇣0[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m++ [2min-sync[0m [2m_[22m [2m║[22m [2m./repo.in-sync[0m [2m║[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m+ [2mno-upstream[0m [2m_[22m [2m./repo.no-upstream[0m [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m⚪ [2mShowing 6 worktrees, 2 ahead[0m