Skip to content

Commit e9de039

Browse files
author
DeathAxe
committed
Enhancement: Show commit hash in blame annotations
The default templates for line annotations and the status bar text are modified to include the commit hash of the selected line.
1 parent 599d422 commit e9de039

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

GitGutter.sublime-settings

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
// {{line_committer_tz} -- the timezone string of commit
181181
// {{line_summary}} -- the first line of the commit message
182182
// {{line_previous}} -- the hash of the previous commit
183-
"line_annotation_text": "{{line_author}} ({{line_author_age}}) · {{line_summary}}",
183+
"line_annotation_text": "{% if line_commit[:7] != '0000000' %} {{line_commit[:7]}} | {% endif %}{{line_author}} ({{line_author_age}}) · {{line_summary}}",
184184

185185
//
186186
// Status Bar
@@ -234,7 +234,7 @@
234234
"{% if deleted > 0 %}, {{deleted}}-{% endif %}",
235235
"{% if inserted > 0 %}, {{inserted}}+{% endif %}",
236236
"{% if modified > 0 %}, {{modified}}≠{% endif %}",
237-
"{% if line_author and line_author_age %}, ⟢ {{line_author}} ({{line_author_age}}){% endif %}",
237+
"{% if line_commit[:7] != '0000000' %}, ⟢ {{line_commit[:7]}} | {{line_author}} ({{line_author_age}}){% endif %}",
238238
"{% endif %}"
239239
]
240240
}

Preferences.sublime-settings-hints

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
// {{line_committer_tz} -- the timezone string of commit
188188
// {{line_summary}} -- the first line of the commit message
189189
// {{line_previous}} -- the hash of the previous commit
190-
"git_gutter_line_annotation_text": "{{line_author}} ({{line_author_age}}) · {{line_summary}}",
190+
"git_gutter_line_annotation_text": "{% if line_commit[:7] != '0000000' %} {{line_commit[:7]}} | {% endif %}{{line_author}} ({{line_author_age}}) · {{line_summary}}",
191191

192192
//
193193
// Status Bar
@@ -241,7 +241,7 @@
241241
"{% if deleted > 0 %}, {{deleted}}-{% endif %}",
242242
"{% if inserted > 0 %}, {{inserted}}+{% endif %}",
243243
"{% if modified > 0 %}, {{modified}}≠{% endif %}",
244-
"{% if line_author and line_author_age %}, ⟢ {{line_author}} ({{line_author_age}}){% endif %}",
244+
"{% if line_commit[:7] != '0000000' %}, ⟢ {{line_commit[:7]}} | {{line_author}} ({{line_author_age}}){% endif %}",
245245
"{% endif %}"
246246
]
247247
}

0 commit comments

Comments
 (0)