From 9cbfa06c582ec5fd47c46719d7879d69ada4be19 Mon Sep 17 00:00:00 2001 From: teernisse Date: Thu, 12 Feb 2026 12:17:54 -0500 Subject: [PATCH] fix: remove jj status check as it was causing divergences for other agents --- defaults.json | 1 - schema.json | 11 ------ src/bin/claude-statusline.rs | 75 +++++++----------------------------- src/config.rs | 2 - src/section/mod.rs | 1 - src/section/vcs.rs | 58 +--------------------------- 6 files changed, 15 insertions(+), 133 deletions(-) diff --git a/defaults.json b/defaults.json index 5bda736..8e0a4d0 100644 --- a/defaults.json +++ b/defaults.json @@ -147,7 +147,6 @@ "enabled": true, "priority": 1, "min_width": 8, - "prefer": "auto", "show_ahead_behind": true, "show_dirty": true, "truncate": { diff --git a/schema.json b/schema.json index 5dc5464..2d39963 100644 --- a/schema.json +++ b/schema.json @@ -188,7 +188,6 @@ "enum": [ "auto", "git", - "jj", "none" ], "description": "VCS detection mode", @@ -375,16 +374,6 @@ "minimum": 0, "default": 8 }, - "prefer": { - "type": "string", - "enum": [ - "auto", - "git", - "jj" - ], - "default": "auto", - "description": "VCS preference. auto detects .jj/ first, then .git/" - }, "show_ahead_behind": { "type": "boolean", "default": true diff --git a/src/bin/claude-statusline.rs b/src/bin/claude-statusline.rs index 8e999aa..8f61be6 100644 --- a/src/bin/claude-statusline.rs +++ b/src/bin/claude-statusline.rs @@ -303,41 +303,14 @@ fn prefetch_shell_outs( std::thread::scope(|s| { let vcs_handle = if needs_vcs { - let args: Vec = match vcs_type { - section::VcsType::Git => vec![ - "git".into(), - "-C".into(), - project_dir.into(), - "status".into(), - "--porcelain=v2".into(), - "--branch".into(), - ], - section::VcsType::Jj => vec![ - "jj".into(), - "log".into(), - "-r".into(), - "@".into(), - "--no-graph".into(), - "-T".into(), - "if(bookmarks, bookmarks.join(\",\"), change_id.shortest(8))".into(), - "--color=never".into(), - ], - section::VcsType::None => vec![], - }; - if args.is_empty() { - None - } else { - let dir = if vcs_type == section::VcsType::Jj { - Some(project_dir.to_string()) - } else { - None - }; - Some(s.spawn(move || { - let prog = &args[0]; - let str_args: Vec<&str> = args[1..].iter().map(|s| s.as_str()).collect(); - shell::exec_gated(shell_config, prog, &str_args, dir.as_deref()) - })) - } + Some(s.spawn(move || { + shell::exec_gated( + shell_config, + "git", + &["-C", project_dir, "status", "--porcelain=v2", "--branch"], + None, + ) + })) } else { None }; @@ -483,34 +456,12 @@ fn resolve_terminal_palette(cache: &cache::Cache) -> Option> { Some(palette) } -fn detect_vcs(dir: &str, config: &config::Config) -> section::VcsType { - let prefer = config.sections.vcs.prefer.as_str(); +fn detect_vcs(dir: &str, _config: &config::Config) -> section::VcsType { let path = std::path::Path::new(dir); - - match prefer { - "jj" => { - if path.join(".jj").is_dir() { - section::VcsType::Jj - } else { - section::VcsType::None - } - } - "git" => { - if path.join(".git").is_dir() { - section::VcsType::Git - } else { - section::VcsType::None - } - } - _ => { - if path.join(".jj").is_dir() { - section::VcsType::Jj - } else if path.join(".git").is_dir() { - section::VcsType::Git - } else { - section::VcsType::None - } - } + if path.join(".git").is_dir() { + section::VcsType::Git + } else { + section::VcsType::None } } diff --git a/src/config.rs b/src/config.rs index 38f521a..de15028 100644 --- a/src/config.rs +++ b/src/config.rs @@ -296,7 +296,6 @@ impl Default for TruncateConfig { pub struct VcsSection { #[serde(flatten)] pub base: SectionBase, - pub prefer: String, pub show_ahead_behind: bool, pub show_dirty: bool, pub untracked: String, @@ -314,7 +313,6 @@ impl Default for VcsSection { min_width: Some(8), ..Default::default() }, - prefer: "auto".into(), show_ahead_behind: true, show_dirty: true, untracked: "normal".into(), diff --git a/src/section/mod.rs b/src/section/mod.rs index bfae40e..8c1dc10 100644 --- a/src/section/mod.rs +++ b/src/section/mod.rs @@ -52,7 +52,6 @@ pub type RenderFn = fn(&RenderContext) -> Option; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum VcsType { Git, - Jj, None, } diff --git a/src/section/vcs.rs b/src/section/vcs.rs index 0e23081..55ddf57 100644 --- a/src/section/vcs.rs +++ b/src/section/vcs.rs @@ -12,7 +12,7 @@ pub fn render(ctx: &RenderContext) -> Option { return None; } - // --no-shell: serve stale cache only, skip all git/jj commands + // --no-shell: serve stale cache only, skip all git commands if ctx.no_shell { return render_stale_cache(ctx); } @@ -21,11 +21,7 @@ pub fn render(ctx: &RenderContext) -> Option { let ttl = &ctx.config.sections.vcs.ttl; let glyphs = &ctx.config.glyphs; - match ctx.vcs_type { - VcsType::Git => render_git(ctx, dir, ttl, glyphs), - VcsType::Jj => render_jj(ctx, dir, ttl, glyphs), - VcsType::None => None, - } + render_git(ctx, dir, ttl, glyphs) } /// Serve stale cached VCS data without running any commands. @@ -158,53 +154,3 @@ fn render_git( Some(SectionOutput { raw, ansi }) } - -fn render_jj( - ctx: &RenderContext, - dir: &str, - ttl: &crate::config::VcsTtl, - glyphs: &crate::config::GlyphConfig, -) -> Option { - use std::time::Duration; - - let branch_ttl = Duration::from_secs(ttl.branch); - - let branch = ctx.cache.get("vcs_branch", branch_ttl).or_else(|| { - // Use prefetched result if available, otherwise exec - let out = ctx.shell_results.get("vcs").cloned().unwrap_or_else(|| { - shell::exec_gated( - ctx.shell_config, - "jj", - &[ - "log", - "-r", - "@", - "--no-graph", - "-T", - "if(bookmarks, bookmarks.join(\",\"), change_id.shortest(8))", - "--color=never", - ], - Some(dir), - ) - })?; - ctx.cache.set("vcs_branch", &out); - Some(out) - })?; - - let trunc = &ctx.config.sections.vcs.truncate; - let branch = if trunc.enabled && trunc.max > 0 { - crate::format::truncate(&branch, trunc.max, &trunc.style) - } else { - branch - }; - - let branch_glyph = glyph::glyph("branch", glyphs); - let raw = format!("{branch_glyph}{branch}"); - let ansi = if ctx.color_enabled { - format!("{}{branch_glyph}{branch}{}", color::GREEN, color::RESET) - } else { - raw.clone() - }; - - Some(SectionOutput { raw, ansi }) -}