Skip to content

Commit

Permalink
fix files table by removing git log usage
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Molina <[email protected]>
  • Loading branch information
erizocosmico authored and ajnavarro committed Jul 5, 2019
1 parent bf8d336 commit 4bf1c80
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 23 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions commit_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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 {
Expand Down
11 changes: 3 additions & 8 deletions files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
}
Expand Down
15 changes: 5 additions & 10 deletions repository_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit 4bf1c80

Please sign in to comment.