mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Keep track of authors across local commits and branch commits for suggestions
Previously, we would only show the authors based on local commits, but sometimes you want to set a commit author to that of a commit on another branch. Now, so long as you've viewed the branch's commits, the author will appear as a suggestion.
This commit is contained in:
parent
a7969aef2c
commit
3cee37388c
7 changed files with 73 additions and 7 deletions
|
@ -266,6 +266,7 @@ func (self *RefreshHelper) refreshCommitsWithLimit() error {
|
|||
return err
|
||||
}
|
||||
self.c.Model().Commits = commits
|
||||
self.RefreshAuthors(commits)
|
||||
self.c.Model().WorkingTreeStateAtLastCommitRefresh = self.c.Git().Status.WorkingTreeState()
|
||||
|
||||
return self.c.PostRefreshUpdate(self.c.Contexts().LocalCommits)
|
||||
|
@ -287,10 +288,26 @@ func (self *RefreshHelper) refreshSubCommitsWithLimit() error {
|
|||
return err
|
||||
}
|
||||
self.c.Model().SubCommits = commits
|
||||
self.RefreshAuthors(commits)
|
||||
|
||||
return self.c.PostRefreshUpdate(self.c.Contexts().SubCommits)
|
||||
}
|
||||
|
||||
func (self *RefreshHelper) RefreshAuthors(commits []*models.Commit) {
|
||||
self.c.Mutexes().AuthorsMutex.Lock()
|
||||
defer self.c.Mutexes().AuthorsMutex.Unlock()
|
||||
|
||||
authors := self.c.Model().Authors
|
||||
for _, commit := range commits {
|
||||
if _, ok := authors[commit.AuthorEmail]; !ok {
|
||||
authors[commit.AuthorEmail] = &models.Author{
|
||||
Email: commit.AuthorEmail,
|
||||
Name: commit.AuthorName,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (self *RefreshHelper) refreshCommitFilesContext() error {
|
||||
ref := self.c.Contexts().CommitFiles.GetRef()
|
||||
to := ref.RefName()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue