feat: show git branch in default footer

This commit is contained in:
Nightt
2026-05-29 15:15:41 +08:00
committed by Hunter Bown
parent 0b7660ddc5
commit 06aa24a17a
2 changed files with 31 additions and 0 deletions
+1
View File
@@ -797,6 +797,7 @@ impl StatusItem {
StatusItem::Agents,
StatusItem::ReasoningReplay,
StatusItem::Cache,
StatusItem::GitBranch,
StatusItem::Tokens,
]
}
+30
View File
@@ -2077,6 +2077,8 @@ fn init_git_repo() -> TempDir {
"user.name=codewhale Tests",
"-c",
"user.email=tests@example.com",
"-c",
"commit.gpgsign=false",
"commit",
"--allow-empty",
"-m",
@@ -5694,6 +5696,10 @@ fn default_footer_keeps_prefix_stability_opt_in() {
items.contains(&crate::config::StatusItem::Cache),
"default footer should still include provider-reported cache hit rate"
);
assert!(
items.contains(&crate::config::StatusItem::GitBranch),
"default footer should surface the current workspace branch"
);
}
#[test]
@@ -5782,6 +5788,30 @@ fn render_footer_from_git_branch_item_renders_workspace_branch() {
assert_eq!(spans_text(&props.cache), "feature/statusline");
}
#[test]
fn default_footer_renders_workspace_branch_when_available() {
let repo = init_git_repo();
let checkout = Command::new("git")
.args(["checkout", "-b", "feature/default-branch-chip"])
.current_dir(repo.path())
.output()
.expect("git checkout should run");
assert!(
checkout.status.success(),
"git checkout failed: {}",
String::from_utf8_lossy(&checkout.stderr)
);
let mut app = create_test_app();
app.workspace = repo.path().to_path_buf();
let props = render_footer_from(&app, &crate::config::StatusItem::default_footer(), None);
assert!(
spans_text(&props.cache).contains("feature/default-branch-chip"),
"default footer should include the current git branch"
);
}
/// Regression for issue #244: visible session spend must not decrease.
/// Sub-agent token usage events arrive out of order and may be reconciled
/// later (cache adjustments, provisional → final swap). The displayed total