Skip to content

Commit 5e1da86

Browse files
authored
internal/function: take into account if repository is resolved (#863)
internal/function: take into account if repository is resolved
2 parents 1738d47 + 5fc6362 commit 5e1da86

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- internal/function: take into account if repository is resolved in commit_stats ([#863](https://github.com/src-d/gitbase/pull/863))
12+
913
### Changed
1014

1115
- Removed vendor folder.

internal/function/commit_stats.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"github.com/src-d/gitbase"
77
"github.com/src-d/gitbase/internal/commitstats"
88

9+
"github.com/src-d/go-mysql-server/sql"
910
"gopkg.in/src-d/go-git.v4/plumbing"
1011
"gopkg.in/src-d/go-git.v4/plumbing/object"
11-
"github.com/src-d/go-mysql-server/sql"
1212
)
1313

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

8787
// Resolved implements the Expression interface.
8888
func (f *CommitStats) Resolved() bool {
89-
return f.To.Resolved() && (f.From == nil || f.From.Resolved())
89+
return f.Repository.Resolved() &&
90+
f.To.Resolved() &&
91+
(f.From == nil || f.From.Resolved())
9092
}
9193

9294
// Eval implements the Expression interface.
@@ -127,7 +129,6 @@ func (f *CommitStats) resolveRepo(ctx *sql.Context, r sql.Row) (*gitbase.Reposit
127129
func (f *CommitStats) resolveCommit(
128130
ctx *sql.Context, r *gitbase.Repository, row sql.Row, e sql.Expression,
129131
) (*object.Commit, error) {
130-
131132
str, err := exprToString(ctx, e, row)
132133
if err != nil {
133134
return nil, err

0 commit comments

Comments
 (0)