git_ui: Show author name on commits in branch picker (#36812)

See related discussion
https://github.com/zed-industries/zed/discussions/36511.

<img alt="zed"
src="https://github.com/user-attachments/assets/da7fc30d-2504-48f4-a392-7c8d5cd8acb1"
/>

Release Notes:

- Added option to show the author name in a branch picker commit
information

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Lev Zakharov
2025-09-09 18:44:46 +00:00
committed by GitHub
co-authored by Conrad Irwin
parent 9529cd18d1
commit 46fb521333
11 changed files with 98 additions and 5 deletions
+6 -1
View File
@@ -150,6 +150,7 @@ pub struct CommitSummary {
pub subject: SharedString,
/// This is a unix timestamp
pub commit_timestamp: i64,
pub author_name: SharedString,
pub has_parent: bool,
}
@@ -987,6 +988,7 @@ impl GitRepository for RealGitRepository {
"%(upstream)",
"%(upstream:track)",
"%(committerdate:unix)",
"%(authorname)",
"%(contents:subject)",
]
.join("%00");
@@ -2022,6 +2024,7 @@ fn parse_branch_input(input: &str) -> Result<Vec<Branch>> {
let upstream_name = fields.next().context("no upstream")?.to_string();
let upstream_tracking = parse_upstream_track(fields.next().context("no upstream:track")?)?;
let commiterdate = fields.next().context("no committerdate")?.parse::<i64>()?;
let author_name = fields.next().context("no authorname")?.to_string().into();
let subject: SharedString = fields
.next()
.context("no contents:subject")?
@@ -2035,6 +2038,7 @@ fn parse_branch_input(input: &str) -> Result<Vec<Branch>> {
sha: head_sha,
subject,
commit_timestamp: commiterdate,
author_name: author_name,
has_parent: !parent_sha.is_empty(),
}),
upstream: if upstream_name.is_empty() {
@@ -2345,7 +2349,7 @@ mod tests {
fn test_branches_parsing() {
// suppress "help: octal escapes are not supported, `\0` is always null"
#[allow(clippy::octal_escapes)]
let input = "*\0060964da10574cd9bf06463a53bf6e0769c5c45e\0\0refs/heads/zed-patches\0refs/remotes/origin/zed-patches\0\01733187470\0generated protobuf\n";
let input = "*\0060964da10574cd9bf06463a53bf6e0769c5c45e\0\0refs/heads/zed-patches\0refs/remotes/origin/zed-patches\0\01733187470\0John Doe\0generated protobuf\n";
assert_eq!(
parse_branch_input(input).unwrap(),
vec![Branch {
@@ -2362,6 +2366,7 @@ mod tests {
sha: "060964da10574cd9bf06463a53bf6e0769c5c45e".into(),
subject: "generated protobuf".into(),
commit_timestamp: 1733187470,
author_name: SharedString::new("John Doe"),
has_parent: false,
})
}]