Skip to content

Commit

Permalink
internal/function: take into account if repository is resolved
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
  • Loading branch information
erizocosmico committed Jun 13, 2019
1 parent 283b7dc commit 13de4fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- internal/function: take into account if repository is resolved in commit_stats ([#863](https://github.com/src-d/gitbase/pull/863))

## [0.21.0-beta1] - 2019-06-12

### Added
Expand Down
7 changes: 4 additions & 3 deletions internal/function/commit_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"github.com/src-d/gitbase"
"github.com/src-d/gitbase/internal/commitstats"

"github.com/src-d/go-mysql-server/sql"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/object"
"github.com/src-d/go-mysql-server/sql"
)

// CommitStats calculates the diff stats for a given commit.
Expand Down Expand Up @@ -86,7 +86,9 @@ func (*CommitStats) IsNullable() bool {

// Resolved implements the Expression interface.
func (f *CommitStats) Resolved() bool {
return f.To.Resolved() && (f.From == nil || f.From.Resolved())
return f.Repository.Resolved() &&
f.To.Resolved() &&
(f.From == nil || f.From.Resolved())
}

// Eval implements the Expression interface.
Expand Down Expand Up @@ -127,7 +129,6 @@ func (f *CommitStats) resolveRepo(ctx *sql.Context, r sql.Row) (*gitbase.Reposit
func (f *CommitStats) resolveCommit(
ctx *sql.Context, r *gitbase.Repository, row sql.Row, e sql.Expression,
) (*object.Commit, error) {

str, err := exprToString(ctx, e, row)
if err != nil {
return nil, err
Expand Down

0 comments on commit 13de4fb

Please sign in to comment.