Use SHORT_SHA_LENGTH for all shortened commit SHAs (#58741)

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Fixes hardcoded SHA lengths not using the `SHORT_SHA_LENGTH` constant.

Release Notes:

- Reduced short commit SHAs in blame and commit tooltips from 8 to 7 -
consistent with the graph and history views.
This commit is contained in:
Albert Bogusz authored and GitHub committed 2026-06-08 06:38:39 +00:00
1 parent 4ef1e64929
commit 11d452f8d1
3 files changed
+5 -3

No files matched your search

+1 -1
View File
@@ -211,7 +211,7 @@ impl BlameRenderer for GitBlameRenderer {
.render(window, cx);
let short_commit_id = sha
.get(..8)
.get(..git::SHORT_SHA_LENGTH)
.map(|sha| sha.to_string().into())
.unwrap_or_else(|| sha.clone());
let local_offset = time::UtcOffset::current_local_offset().unwrap_or(time::UtcOffset::UTC);
+1 -1
View File
@@ -238,7 +238,7 @@ impl Render for CommitTooltip {
let short_commit_id = self
.commit
.sha
.get(0..8)
.get(0..git::SHORT_SHA_LENGTH)
.map(|sha| sha.to_string().into())
.unwrap_or_else(|| self.commit.sha.clone());
let full_sha = self.commit.sha.to_string();
+3 -1
View File
@@ -324,7 +324,9 @@ impl CommitView {
.or(first_worktree_id)
})
.context("project has no worktrees")?;
let short_sha = commit_sha.get(0..7).unwrap_or(&commit_sha);
let short_sha = commit_sha
.get(0..git::SHORT_SHA_LENGTH)
.unwrap_or(&commit_sha);
let file_name = file
.path
.file_name()