1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

support setting the author of a commit

update copy
This commit is contained in:
Jesse Duffield
2022-05-08 21:05:01 +10:00
parent 901ab3ac1b
commit 9591cc381a
31 changed files with 141 additions and 14 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/jesseduffield/minimal/gitignore"
"github.com/samber/lo"
"gopkg.in/ozeidan/fuzzy-patricia.v3/patricia"
)
@ -174,6 +175,14 @@ func (self *SuggestionsHelper) GetRefsSuggestionsFunc() func(string) []*types.Su
return FuzzySearchFunc(refNames)
}
func (self *SuggestionsHelper) GetAuthorsSuggestionsFunc() func(string) []*types.Suggestion {
authors := lo.Uniq(slices.Map(self.model.Commits, func(commit *models.Commit) string {
return fmt.Sprintf("%s <%s>", commit.AuthorName, commit.AuthorEmail)
}))
return FuzzySearchFunc(authors)
}
func FuzzySearchFunc(options []string) func(string) []*types.Suggestion {
return func(input string) []*types.Suggestion {
var matches []string