From 5b3b684f02a7433af213809184ca61b379e110f4 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 27 Nov 2023 13:01:08 +0100 Subject: pkg/vcs: delete ListRecentCommits() It's not needed anymore. --- pkg/vcs/fuchsia.go | 4 ---- pkg/vcs/git.go | 11 ----------- pkg/vcs/git_repo_test.go | 10 ---------- pkg/vcs/vcs.go | 3 --- 4 files changed, 28 deletions(-) (limited to 'pkg') diff --git a/pkg/vcs/fuchsia.go b/pkg/vcs/fuchsia.go index bf1bedd9f..223c0b860 100644 --- a/pkg/vcs/fuchsia.go +++ b/pkg/vcs/fuchsia.go @@ -80,10 +80,6 @@ func (ctx *fuchsia) GetCommitsByTitles(titles []string) ([]*Commit, []string, er return ctx.repo.GetCommitsByTitles(titles) } -func (ctx *fuchsia) ListRecentCommits(baseCommit string) ([]string, error) { - return ctx.repo.ListRecentCommits(baseCommit) -} - func (ctx *fuchsia) ExtractFixTagsFromCommits(baseCommit, email string) ([]*Commit, error) { return ctx.repo.ExtractFixTagsFromCommits(baseCommit, email) } diff --git a/pkg/vcs/git.go b/pkg/vcs/git.go index b3e9a7ace..71fcac97a 100644 --- a/pkg/vcs/git.go +++ b/pkg/vcs/git.go @@ -366,17 +366,6 @@ func (git *git) GetCommitsByTitles(titles []string) ([]*Commit, []string, error) return results, missing, nil } -func (git *git) ListRecentCommits(baseCommit string) ([]string, error) { - // On upstream kernel this produces ~11MB of output. - // Somewhat inefficient to collect whole output in a slice - // and then convert to string, but should be bearable. - output, err := git.git("log", "--pretty=format:%s", "-n", "200000", baseCommit) - if err != nil { - return nil, err - } - return strings.Split(string(output), "\n"), nil -} - func (git *git) ListCommitHashes(baseCommit string) ([]string, error) { output, err := git.git("log", "--pretty=format:%h", baseCommit) if err != nil { diff --git a/pkg/vcs/git_repo_test.go b/pkg/vcs/git_repo_test.go index adf222629..315cea5df 100644 --- a/pkg/vcs/git_repo_test.go +++ b/pkg/vcs/git_repo_test.go @@ -53,16 +53,6 @@ func TestGitRepo(t *testing.T) { t.Fatal(diff) } } - { - commits, err := repo.ListRecentCommits(repo1.Commits["branch1"]["1"].Hash) - if err != nil { - t.Fatal(err) - } - want := []string{"repo1-branch1-1", "repo1-branch1-0", "repo1-master-0"} - if diff := cmp.Diff(commits, want); diff != "" { - t.Fatal(diff) - } - } { want := repo2.Commits["branch1"]["0"] com, err := repo.CheckoutCommit(repo2.Dir, want.Hash) diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go index ec17d642b..a83f66835 100644 --- a/pkg/vcs/vcs.go +++ b/pkg/vcs/vcs.go @@ -48,9 +48,6 @@ type Repo interface { // Returns list of commits and titles of commits that are not found. GetCommitsByTitles(titles []string) ([]*Commit, []string, error) - // ListRecentCommits returns list of recent commit titles starting from baseCommit. - ListRecentCommits(baseCommit string) ([]string, error) - // ExtractFixTagsFromCommits extracts fixing tags for bugs from git log. // Given email = "user@domain.com", it searches for tags of the form "user+tag@domain.com" // and returns commits with these tags. -- cgit mrf-deployment