Skip to content

Commit 86a644a

Browse files
committed
fix(blame): abbreviate commits to 7 characters
Conventionally, Git commits in hexadecimal are abbreviated to 7 characters (or more if necessary). By matching this, we can more easily identify matching commits at a glance between the gitsigns blame output and other tools that print abbreviated commit hashes. Additionally, we save a character, making the output (marginally) easier to fit.
1 parent db486b4 commit 86a644a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lua/gitsigns/git/blame.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ local function not_committed(file)
4949
local time = os.time()
5050
return {
5151
sha = string.rep('0', 40),
52-
abbrev_sha = string.rep('0', 8),
52+
abbrev_sha = string.rep('0', 7),
5353
author = 'Not Committed Yet',
5454
author_mail = '<not.committed.yet>',
5555
author_tz = '+0000',
@@ -98,7 +98,7 @@ local function incremental_iter(readline, commits, result)
9898
local commit = commits[sha]
9999
or {
100100
sha = sha,
101-
abbrev_sha = sha:sub(1, 8) --[[@as string]],
101+
abbrev_sha = sha:sub(1, 7) --[[@as string]],
102102
}
103103

104104
--- @type string?, string?

0 commit comments

Comments
 (0)