Skip to content

Commit e84f7c8

Browse files
bellmanGajae Code
authored andcommitted
fix: report 'no_git_repo' instead of 'clean' when not in git (#125)
status/doctor JSON now reports git_state:'no_git_repo' when project_root is None, instead of the misleading 'clean' which implied a git repo was present with zero changes. Generated with https://github.com/Yeachan-Heo/gajae-code Co-authored-by: Gajae Code <dev@gajae-code.com>
1 parent b8f0663 commit e84f7c8

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

  • rust/crates/rusty-claude-cli/src

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4268,7 +4268,14 @@ fn check_workspace_health(context: &StatusContext) -> DiagnosticCheck {
42684268
"Git branch {}",
42694269
context.git_branch.as_deref().unwrap_or("unknown")
42704270
),
4271-
format!("Git state {}", context.git_summary.headline()),
4271+
format!(
4272+
"Git state {}",
4273+
if context.project_root.is_some() {
4274+
context.git_summary.headline()
4275+
} else {
4276+
"no git repo".to_string()
4277+
}
4278+
),
42724279
format!("Changed files {}", context.git_summary.changed_files),
42734280
format!(
42744281
"Memory files {} · config files loaded {}/{}",
@@ -4305,7 +4312,11 @@ fn check_workspace_health(context: &StatusContext) -> DiagnosticCheck {
43054312
("git_branch".to_string(), json!(context.git_branch)),
43064313
(
43074314
"git_state".to_string(),
4308-
json!(context.git_summary.headline()),
4315+
json!(if context.project_root.is_some() {
4316+
context.git_summary.headline()
4317+
} else {
4318+
"no_git_repo".to_string()
4319+
}),
43094320
),
43104321
(
43114322
"changed_files".to_string(),
@@ -9407,7 +9418,7 @@ fn status_json_value(
94079418
"cwd": context.cwd,
94089419
"project_root": context.project_root,
94099420
"git_branch": context.git_branch,
9410-
"git_state": context.git_summary.headline(),
9421+
"git_state": if context.project_root.is_some() { context.git_summary.headline() } else { "no_git_repo".to_string() },
94119422
// #408: changed_files counts ALL non-clean files (staged + unstaged + untracked + conflicted)
94129423
"changed_files": context.git_summary.changed_files,
94139424
"is_clean": context.git_summary.changed_files == 0,
@@ -9654,7 +9665,11 @@ fn format_status_report(
96549665
.as_ref()
96559666
.map_or_else(|| "unknown".to_string(), |path| path.display().to_string()),
96569667
context.git_branch.as_deref().unwrap_or("unknown"),
9657-
context.git_summary.headline(),
9668+
if context.project_root.is_some() {
9669+
context.git_summary.headline()
9670+
} else {
9671+
"no_git_repo".to_string()
9672+
},
96589673
context.git_summary.changed_files,
96599674
context.git_summary.staged_files,
96609675
context.git_summary.unstaged_files,

0 commit comments

Comments
 (0)