修复右侧边栏“提交”区域在没有提交记录时显示错误
This commit is contained in:
@@ -2475,6 +2475,13 @@ pub async fn git_log(
|
||||
.map_err(AppCommandError::io)?;
|
||||
|
||||
if !output.status.success() {
|
||||
// Empty repo (no commits yet) — return empty list instead of error
|
||||
let stderr_str = String::from_utf8_lossy(&output.stderr);
|
||||
if stderr_str.contains("does not have any commits yet")
|
||||
|| stderr_str.contains("unknown revision or path not in the working tree")
|
||||
{
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
return Err(git_command_error("log", &output.stderr));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user