Skip to content

Commit

Permalink
enable fix
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 committed Nov 14, 2021
1 parent 0d2d214 commit eea12af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions server/store/datastore/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,17 @@ func (s storage) RepoBatch(repos []*model.Repo) error {
if exist {
if _, err := sess.
Where("repo_owner = ? AND repo_name = ?", repos[i].Owner, repos[i].Name).
// Cols("repo_avatar", "repo_link", "repo_private", "repo_clone", "repo_branch"). // FIX
AllCols().
Cols("repo_scm", "repo_avatar", "repo_link", "repo_private", "repo_clone", "repo_branch").
Update(repos[i]); err != nil {
return err
}

_, err := sess.
Where("repo_owner = ? AND repo_name = ?", repos[i].Owner, repos[i].Name).
Get(repos[i])
if err != nil {
return err
}
} else {
// only Insert on single object ref set auto created ID back to object
if _, err := sess.Insert(repos[i]); err != nil {
Expand Down
5 changes: 3 additions & 2 deletions server/store/datastore/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,12 @@ func TestRepoBatch(t *testing.T) {
}
assert.NoError(t, store.RepoBatch([]*model.Repo{repo}))
assert.EqualValues(t, repos[0].ID, repo.ID)
_, err := store.engine.ID(repo.ID).Get(repo)
assert.NoError(t, err)
assert.True(t, repo.IsActive)

allRepos := make([]*model.Repo, 0, 4)
err := store.engine.Find(&allRepos)
assert.NoError(t, err)
assert.NoError(t, store.engine.Find(&allRepos))
assert.Len(t, allRepos, 4)

count, err := store.GetRepoCount()
Expand Down

0 comments on commit eea12af

Please sign in to comment.