From 92755894e7f0398871e13c7916df6acea7d16d8f Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Tue, 10 May 2022 13:15:47 +0200 Subject: pkg/vcs/git: fetch commits not older than five years Increase the maximum age of fetched commits when searching for fix tags and commit titles. This enables syz-ci to find older commits provided with '#syz fix' commands. https://groups.google.com/g/syzkaller/c/nbd2tUr5AhU Signed-off-by: Alexander Egorenkov --- pkg/vcs/git.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pkg/vcs') diff --git a/pkg/vcs/git.go b/pkg/vcs/git.go index b1ee502d6..63901b850 100644 --- a/pkg/vcs/git.go +++ b/pkg/vcs/git.go @@ -308,6 +308,10 @@ func (git *git) GetCommitByTitle(title string) (*Commit, error) { return commits[0], nil } +const ( + fetchCommitsMaxAgeInYears = 5 +) + func (git *git) GetCommitsByTitles(titles []string) ([]*Commit, []string, error) { var greps []string m := make(map[string]string) @@ -316,7 +320,7 @@ func (git *git) GetCommitsByTitles(titles []string) ([]*Commit, []string, error) greps = append(greps, canonical) m[canonical] = title } - since := time.Now().Add(-time.Hour * 24 * 365 * 2).Format("01-02-2006") + since := time.Now().Add(-time.Hour * 24 * 365 * fetchCommitsMaxAgeInYears).Format("01-02-2006") commits, err := git.fetchCommits(since, "HEAD", "", "", greps, true) if err != nil { return nil, nil, err @@ -354,7 +358,7 @@ func (git *git) ExtractFixTagsFromCommits(baseCommit, email string) ([]*Commit, return nil, fmt.Errorf("failed to parse email %q: %v", email, err) } grep := user + "+.*" + domain - since := time.Now().Add(-time.Hour * 24 * 365).Format("01-02-2006") + since := time.Now().Add(-time.Hour * 24 * 365 * fetchCommitsMaxAgeInYears).Format("01-02-2006") return git.fetchCommits(since, baseCommit, user, domain, []string{grep}, false) } -- cgit mrf-deployment