mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-18 03:49:50 -06:00
Extract CommitDescription from Commit.Description
A later commit describes a detached HEAD in the same way. Make it work for hashes shorter than 7 characters. The Name of a detached HEAD is "HEAD" if `git branch --points-at=HEAD` doesn't report it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9dcef62ff2
commit
6348e8a6af
1 file changed
+7
-1
@@ -151,7 +151,13 @@ func (c *Commit) ID() string {
|
||||
}
|
||||
|
||||
func (c *Commit) Description() string {
|
||||
return fmt.Sprintf("%s %s", c.Hash()[:7], c.Name)
|
||||
return CommitDescription(c.Hash(), c.Name)
|
||||
}
|
||||
|
||||
// CommitDescription returns the short hash and the subject of a commit, e.g.
|
||||
// "6f71c57 Fix the thing".
|
||||
func CommitDescription(hash string, subject string) string {
|
||||
return fmt.Sprintf("%s %s", hash[:min(7, len(hash))], subject)
|
||||
}
|
||||
|
||||
func (c *Commit) IsMerge() bool {
|
||||
|
||||
Reference in new issue
Block a user