mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Add author filtering to commit view
This commit introduces a new feature to the commit view, allowing users to filter commits based on the author's name or email address. Similar to the existing path filtering functionality, accessible through <c-s>, this feature allows users to filter the commit history by the currently selected commit's author if the commit view is focused, or by typing in the author's name or email address. This feature adds an entry to the filtering menu, to provide users with a familiar and intuitive experience
This commit is contained in:
parent
329b434915
commit
503422a72e
22 changed files with 292 additions and 27 deletions
|
@ -317,6 +317,7 @@ func (self *RefreshHelper) refreshCommitsWithLimit() error {
|
|||
git_commands.GetCommitsOptions{
|
||||
Limit: self.c.Contexts().LocalCommits.GetLimitCommits(),
|
||||
FilterPath: self.c.Modes().Filtering.GetPath(),
|
||||
FilterAuthor: self.c.Modes().Filtering.GetAuthor(),
|
||||
IncludeRebaseCommits: true,
|
||||
RefName: self.refForLog(),
|
||||
RefForPushedStatus: checkedOutBranchName,
|
||||
|
@ -342,6 +343,7 @@ func (self *RefreshHelper) refreshSubCommitsWithLimit() error {
|
|||
git_commands.GetCommitsOptions{
|
||||
Limit: self.c.Contexts().SubCommits.GetLimitCommits(),
|
||||
FilterPath: self.c.Modes().Filtering.GetPath(),
|
||||
FilterAuthor: self.c.Modes().Filtering.GetAuthor(),
|
||||
IncludeRebaseCommits: false,
|
||||
RefName: self.c.Contexts().SubCommits.GetRef().FullRefName(),
|
||||
RefToShowDivergenceFrom: self.c.Contexts().SubCommits.GetRefToShowDivergenceFrom(),
|
||||
|
@ -438,7 +440,7 @@ func (self *RefreshHelper) refreshBranches(refreshWorktrees bool, keepBranchSele
|
|||
// which allows us to order them correctly. So if we're filtering we'll just
|
||||
// manually load all the reflog commits here
|
||||
var err error
|
||||
reflogCommits, _, err = self.c.Git().Loaders.ReflogCommitLoader.GetReflogCommits(nil, "")
|
||||
reflogCommits, _, err = self.c.Git().Loaders.ReflogCommitLoader.GetReflogCommits(nil, "", "")
|
||||
if err != nil {
|
||||
self.c.Log.Error(err)
|
||||
}
|
||||
|
@ -597,9 +599,9 @@ func (self *RefreshHelper) refreshReflogCommits() error {
|
|||
lastReflogCommit = model.ReflogCommits[0]
|
||||
}
|
||||
|
||||
refresh := func(stateCommits *[]*models.Commit, filterPath string) error {
|
||||
refresh := func(stateCommits *[]*models.Commit, filterPath string, filterAuthor string) error {
|
||||
commits, onlyObtainedNewReflogCommits, err := self.c.Git().Loaders.ReflogCommitLoader.
|
||||
GetReflogCommits(lastReflogCommit, filterPath)
|
||||
GetReflogCommits(lastReflogCommit, filterPath, filterAuthor)
|
||||
if err != nil {
|
||||
return self.c.Error(err)
|
||||
}
|
||||
|
@ -612,12 +614,12 @@ func (self *RefreshHelper) refreshReflogCommits() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if err := refresh(&model.ReflogCommits, ""); err != nil {
|
||||
if err := refresh(&model.ReflogCommits, "", ""); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if self.c.Modes().Filtering.Active() {
|
||||
if err := refresh(&model.FilteredReflogCommits, self.c.Modes().Filtering.GetPath()); err != nil {
|
||||
if err := refresh(&model.FilteredReflogCommits, self.c.Modes().Filtering.GetPath(), self.c.Modes().Filtering.GetAuthor()); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue