diff --git a/CHANGELOG.md b/CHANGELOG.md index d63621613..4ee41bf7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.23.1] - 2019-07-05 + +### Fixed + +- Fix the results of files table by not using git log. + ## [0.23.0] - 2019-07-04 ### Changed diff --git a/commit_files_test.go b/commit_files_test.go index 9c879ddda..1a8ce8611 100644 --- a/commit_files_test.go +++ b/commit_files_test.go @@ -7,7 +7,6 @@ import ( "github.com/src-d/go-mysql-server/sql" "github.com/src-d/go-mysql-server/sql/expression" "github.com/stretchr/testify/require" - git "gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4/plumbing" ) @@ -36,9 +35,7 @@ func TestCommitFilesTableRowIter(t *testing.T) { require.NoError(err) - commits, err := repo.Log(&git.LogOptions{ - All: true, - }) + commits, err := newCommitIter(repo, false) require.NoError(err) for { diff --git a/files.go b/files.go index 85ee2e821..941d74413 100644 --- a/files.go +++ b/files.go @@ -4,11 +4,10 @@ import ( "bytes" "io" - git "gopkg.in/src-d/go-git.v4" + "github.com/src-d/go-mysql-server/sql" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/filemode" "gopkg.in/src-d/go-git.v4/plumbing/object" - "github.com/src-d/go-mysql-server/sql" ) type filesTable struct { @@ -199,9 +198,7 @@ type filesRowIter struct { func (i *filesRowIter) init() error { var err error i.seen = make(map[plumbing.Hash]struct{}) - i.commits, err = i.repo.Log(&git.LogOptions{ - All: true, - }) + i.commits, err = newCommitIter(i.repo, i.skipGitErrors) return err } @@ -419,9 +416,7 @@ func newFilesKeyValueIter(pool *RepositoryPool, repo *Repository, columns []stri return nil, err } - commits, err := repo.Log(&git.LogOptions{ - All: true, - }) + commits, err := newCommitIter(repo, false) if err != nil { return nil, err } diff --git a/files_test.go b/files_test.go index 998238e3e..1397efa67 100644 --- a/files_test.go +++ b/files_test.go @@ -148,7 +148,7 @@ func TestFilesTablePushdownFilters(t *testing.T) { rows[i] = row[1 : len(row)-2] } - require.Equal(tt.expected, rows) + require.ElementsMatch(tt.expected, rows) }) } } diff --git a/repository_pool_test.go b/repository_pool_test.go index 8ad30467a..ebfce5b87 100644 --- a/repository_pool_test.go +++ b/repository_pool_test.go @@ -9,7 +9,6 @@ import ( fixtures "github.com/src-d/go-git-fixtures" "github.com/stretchr/testify/require" - git "gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4/plumbing/cache" "gopkg.in/src-d/go-git.v4/plumbing/object" ) @@ -78,9 +77,7 @@ func TestRepositoryPoolGit(t *testing.T) { require.NotNil(repo) require.NoError(err) - iter, err := repo.Log(&git.LogOptions{ - All: true, - }) + iter, err := newCommitIter(repo, false) require.NoError(err) count := 0 @@ -165,9 +162,9 @@ func TestRepositoryPoolSiva(t *testing.T) { expectedRepos := 5 expected := map[string]int{ "015da2f4-6d89-7ec8-5ac9-a38329ea875b": 606, - "015dcc49-9049-b00c-ba72-b6f5fa98cbe7": 68, - "015dcc49-90e6-34f2-ac03-df879ee269f3": 21, - "015dcc4d-0bdf-6aff-4aac-ffe68c752eb3": 380, + "015dcc49-9049-b00c-ba72-b6f5fa98cbe7": 71, + "015dcc49-90e6-34f2-ac03-df879ee269f3": 45, + "015dcc4d-0bdf-6aff-4aac-ffe68c752eb3": 382, "015dcc4d-2622-bdac-12a5-ec441e3f3508": 72, } result := make(map[string]int) @@ -183,9 +180,7 @@ func TestRepositoryPoolSiva(t *testing.T) { } require.NoError(err) - iter, err := repo.Log(&git.LogOptions{ - All: true, - }) + iter, err := newCommitIter(repo, false) require.NoError(err) id := repo.ID()