diff --git a/commit.go b/commit.go index dc5f2bd14..fa5e18561 100644 --- a/commit.go +++ b/commit.go @@ -198,8 +198,8 @@ func (c *Commit) CommitsBeforeUntil(commitID string) (*list.List, error) { } // SearchCommits returns the commits match the keyword before current revision -func (c *Commit) SearchCommits(keyword string) (*list.List, error) { - return c.repo.searchCommits(c.ID, keyword) +func (c *Commit) SearchCommits(keyword string, all bool) (*list.List, error) { + return c.repo.searchCommits(c.ID, keyword, all) } // GetFilesChangedSinceCommit get all changed file names between pastCommit to current revision diff --git a/repo_commit.go b/repo_commit.go index 133d7947c..97f44abda 100644 --- a/repo_commit.go +++ b/repo_commit.go @@ -196,8 +196,12 @@ func (repo *Repository) commitsByRange(id SHA1, page int) (*list.List, error) { return repo.parsePrettyFormatLogToList(stdout) } -func (repo *Repository) searchCommits(id SHA1, keyword string) (*list.List, error) { - stdout, err := NewCommand("log", id.String(), "-100", "-i", "--grep="+keyword, prettyLogFormat).RunInDirBytes(repo.Path) +func (repo *Repository) searchCommits(id SHA1, keyword string, all bool) (*list.List, error) { + cmd := NewCommand("log", id.String(), "-100", "-i", "--grep="+keyword, prettyLogFormat) + if all { + cmd.AddArguments("--all") + } + stdout, err := cmd.RunInDirBytes(repo.Path) if err != nil { return nil, err }