Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2021-07-28 11:58:28 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-07-29 10:57:07 +0300
commit794589bb744ba44059b801dc37630997719cbaed (patch)
tree952539cf44de1b22ee66fd242c102289b4dc527a
parent9bfaa0060f63c35115ada469bc833a199ac3dd67 (diff)
lint: Fix deprecated import github.com/golang/protobuf/ptypes
The dependency github.com/golang/protobuf is deprecated and should be replaced with google.golang.org/protobuf. This change replaces usage of the ptypes package. The replacement packages has a different structure and it requires code changes to be done to migrate. The exclusion rules removed from the golanci-lint tool configuration file to prevent future use of the deprecated package.
-rw-r--r--.golangci.yml12
-rw-r--r--internal/git/catfile/commit.go4
-rw-r--r--internal/git/catfile/commit_test.go5
-rw-r--r--internal/git/gittest/testdata.go18
-rw-r--r--internal/git/localrepo/objects_test.go14
-rw-r--r--internal/gitaly/service/commit/commits_by_message_test.go6
-rw-r--r--internal/gitaly/service/commit/count_commits_test.go6
-rw-r--r--internal/gitaly/service/commit/find_commit_test.go26
-rw-r--r--internal/gitaly/service/commit/find_commits_test.go22
-rw-r--r--internal/gitaly/service/commit/list_all_commits_test.go6
-rw-r--r--internal/gitaly/service/commit/list_commits_test.go6
-rw-r--r--internal/gitaly/service/commit/testhelper_test.go4
-rw-r--r--internal/gitaly/service/conflicts/resolve_conflicts.go6
-rw-r--r--internal/gitaly/service/conflicts/resolve_conflicts_test.go10
-rw-r--r--internal/gitaly/service/operations/cherry_pick.go6
-rw-r--r--internal/gitaly/service/operations/cherry_pick_test.go8
-rw-r--r--internal/gitaly/service/operations/commit_files_test.go5
-rw-r--r--internal/gitaly/service/operations/merge_test.go14
-rw-r--r--internal/gitaly/service/operations/rebase.go6
-rw-r--r--internal/gitaly/service/operations/rebase_test.go6
-rw-r--r--internal/gitaly/service/operations/revert_test.go8
-rw-r--r--internal/gitaly/service/operations/squash_test.go10
-rw-r--r--internal/gitaly/service/operations/submodules_test.go8
-rw-r--r--internal/gitaly/service/operations/tags_test.go3
-rw-r--r--internal/gitaly/service/operations/utils.go7
-rw-r--r--internal/gitaly/service/ref/refnames.go8
-rw-r--r--internal/gitaly/service/ref/refnames_containing.go6
-rw-r--r--internal/gitaly/service/ref/refs_test.go41
-rw-r--r--internal/gitaly/service/ref/util_test.go26
-rw-r--r--internal/helper/chunk/chunker_test.go6
-rw-r--r--internal/praefect/coordinator_test.go6
-rw-r--r--internal/praefect/middleware/errorhandler_test.go10
-rw-r--r--internal/praefect/mocksvc_test.go10
-rw-r--r--internal/praefect/server_test.go18
-rw-r--r--internal/testhelper/gitlabtest.go58
35 files changed, 191 insertions, 224 deletions
diff --git a/.golangci.yml b/.golangci.yml
index a07887ff4..18171951f 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -705,22 +705,10 @@ issues:
## BEGIN staticcheck exclusions
- linters:
- staticcheck
- text: "package github.com/golang/protobuf/ptypes is deprecated"
- - linters:
- - staticcheck
- text: "proto.MessageName is deprecated"
- - linters:
- - staticcheck
- text: "ptypes.Timestamp is deprecated"
- - linters:
- - staticcheck
text: "resp.OldPath is deprecated"
- linters:
- staticcheck
text: "resp.NewPath is deprecated"
- - linters:
- - staticcheck
- text: "proto.MessageType is deprecated"
## END staticcheck exclusions
# govet checks all struct initializations must be keyed by field names
- linters:
diff --git a/internal/git/catfile/commit.go b/internal/git/catfile/commit.go
index 76047849d..ac9afe566 100644
--- a/internal/git/catfile/commit.go
+++ b/internal/git/catfile/commit.go
@@ -10,12 +10,12 @@ import (
"strconv"
"strings"
- "github.com/golang/protobuf/ptypes/timestamp"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/repository"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/trailerparser"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
// GetCommit looks up a commit by revision using an existing Batch instance.
@@ -181,7 +181,7 @@ func parseCommitAuthor(line string) *gitalypb.CommitAuthor {
sec = git.FallbackTimeValue.Unix()
}
- author.Date = &timestamp.Timestamp{Seconds: sec}
+ author.Date = &timestamppb.Timestamp{Seconds: sec}
if len(secSplit) == 2 {
author.Timezone = []byte(secSplit[1])
diff --git a/internal/git/catfile/commit_test.go b/internal/git/catfile/commit_test.go
index 212e0ae97..74c6051fd 100644
--- a/internal/git/catfile/commit_test.go
+++ b/internal/git/catfile/commit_test.go
@@ -5,7 +5,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
@@ -78,7 +77,7 @@ func TestParseCommit(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Jane Doe"),
Email: []byte("janedoe@example.com"),
- Date: &timestamp.Timestamp{Seconds: 9223371974719179007},
+ Date: &timestamppb.Timestamp{Seconds: 9223371974719179007},
Timezone: []byte("+0200"),
},
},
@@ -91,7 +90,7 @@ func TestParseCommit(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Jane Doe"),
Email: []byte("janedoe@example.com"),
- Date: &timestamp.Timestamp{Seconds: 9223371974719179007},
+ Date: &timestamppb.Timestamp{Seconds: 9223371974719179007},
Timezone: []byte("+0200"),
},
},
diff --git a/internal/git/gittest/testdata.go b/internal/git/gittest/testdata.go
index 7744dc866..429cd1c0d 100644
--- a/internal/git/gittest/testdata.go
+++ b/internal/git/gittest/testdata.go
@@ -1,8 +1,8 @@
package gittest
import (
- "github.com/golang/protobuf/ptypes/timestamp"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
// CommitsByID is a map of GitCommit structures by their respective IDs.
@@ -241,7 +241,7 @@ func alejandroRodriguez(ts int64) *gitalypb.CommitAuthor {
return &gitalypb.CommitAuthor{
Name: []byte("Alejandro Rodríguez"),
Email: []byte("alejorro70@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: ts},
+ Date: &timestamppb.Timestamp{Seconds: ts},
Timezone: []byte("-0300"),
}
}
@@ -250,7 +250,7 @@ func ahmadSherif(ts int64) *gitalypb.CommitAuthor {
return &gitalypb.CommitAuthor{
Name: []byte("Ahmad Sherif"),
Email: []byte("ahmad+gitlab-test@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: ts},
+ Date: &timestamppb.Timestamp{Seconds: ts},
Timezone: []byte("+0200"),
}
}
@@ -259,7 +259,7 @@ func drewBlessing(ts int64) *gitalypb.CommitAuthor {
return &gitalypb.CommitAuthor{
Name: []byte("Drew Blessing"),
Email: []byte("drew@blessing.io"),
- Date: &timestamp.Timestamp{Seconds: ts},
+ Date: &timestamppb.Timestamp{Seconds: ts},
Timezone: []byte("+0000"),
}
}
@@ -268,7 +268,7 @@ func dmitriyZaporozhets(ts int64) *gitalypb.CommitAuthor {
return &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: ts},
+ Date: &timestamppb.Timestamp{Seconds: ts},
Timezone: []byte("-0800"),
}
}
@@ -277,7 +277,7 @@ func jamesEdwardsJones(ts int64) *gitalypb.CommitAuthor {
return &gitalypb.CommitAuthor{
Name: []byte("James Edwards-Jones"),
Email: []byte("jedwardsjones@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: ts},
+ Date: &timestamppb.Timestamp{Seconds: ts},
Timezone: []byte("+0000"),
}
}
@@ -286,7 +286,7 @@ func lukeBennett(ts int64) *gitalypb.CommitAuthor {
return &gitalypb.CommitAuthor{
Name: []byte("Luke \"Jared\" Bennett"),
Email: []byte("lbennett@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: ts},
+ Date: &timestamppb.Timestamp{Seconds: ts},
Timezone: []byte("+0000"),
}
}
@@ -295,7 +295,7 @@ func seanMcGivern(ts int64) *gitalypb.CommitAuthor {
return &gitalypb.CommitAuthor{
Name: []byte("Sean McGivern"),
Email: []byte("sean@mcgivern.me.uk"),
- Date: &timestamp.Timestamp{Seconds: ts},
+ Date: &timestamppb.Timestamp{Seconds: ts},
Timezone: []byte("+0000"),
}
}
@@ -304,7 +304,7 @@ func stanHu(ts int64) *gitalypb.CommitAuthor {
return &gitalypb.CommitAuthor{
Name: []byte("Stan Hu"),
Email: []byte("stanhu@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: ts},
+ Date: &timestamppb.Timestamp{Seconds: ts},
Timezone: []byte("+0000"),
}
}
diff --git a/internal/git/localrepo/objects_test.go b/internal/git/localrepo/objects_test.go
index 49ad94d42..90f3cfe7f 100644
--- a/internal/git/localrepo/objects_test.go
+++ b/internal/git/localrepo/objects_test.go
@@ -10,7 +10,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
@@ -20,6 +19,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func setupRepo(t *testing.T, bare bool) (*Repo, string) {
@@ -325,7 +325,7 @@ func TestRepo_ReadCommit(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Drew Blessing"),
Email: []byte("drew@blessing.io"),
- Date: &timestamp.Timestamp{
+ Date: &timestamppb.Timestamp{
Seconds: 1540830087,
},
Timezone: []byte("+0000"),
@@ -333,7 +333,7 @@ func TestRepo_ReadCommit(t *testing.T) {
Committer: &gitalypb.CommitAuthor{
Name: []byte("Drew Blessing"),
Email: []byte("drew@blessing.io"),
- Date: &timestamp.Timestamp{
+ Date: &timestamppb.Timestamp{
Seconds: 1540830087,
},
Timezone: []byte("+0000"),
@@ -355,7 +355,7 @@ func TestRepo_ReadCommit(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{
+ Date: &timestamppb.Timestamp{
Seconds: 1393491698,
},
Timezone: []byte("+0200"),
@@ -363,7 +363,7 @@ func TestRepo_ReadCommit(t *testing.T) {
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{
+ Date: &timestamppb.Timestamp{
Seconds: 1393491698,
},
Timezone: []byte("+0200"),
@@ -387,7 +387,7 @@ func TestRepo_ReadCommit(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{
+ Date: &timestamppb.Timestamp{
Seconds: 1393491698,
},
Timezone: []byte("+0200"),
@@ -395,7 +395,7 @@ func TestRepo_ReadCommit(t *testing.T) {
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{
+ Date: &timestamppb.Timestamp{
Seconds: 1393491698,
},
Timezone: []byte("+0200"),
diff --git a/internal/gitaly/service/commit/commits_by_message_test.go b/internal/gitaly/service/commit/commits_by_message_test.go
index 052ea1c4d..e0a93cdba 100644
--- a/internal/gitaly/service/commit/commits_by_message_test.go
+++ b/internal/gitaly/service/commit/commits_by_message_test.go
@@ -3,12 +3,12 @@ package commit
import (
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
var rubyFilesCommit = []*gitalypb.GitCommit{
@@ -19,13 +19,13 @@ var rubyFilesCommit = []*gitalypb.GitCommit{
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393488896},
+ Date: &timestamppb.Timestamp{Seconds: 1393488896},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393488896},
+ Date: &timestamppb.Timestamp{Seconds: 1393488896},
Timezone: []byte("+0200"),
},
ParentIds: []string{"cfe32cf61b73a0d5e9f13e774abde7ff789b1660"},
diff --git a/internal/gitaly/service/commit/count_commits_test.go b/internal/gitaly/service/commit/count_commits_test.go
index 659b69e68..c0e6cf42e 100644
--- a/internal/gitaly/service/commit/count_commits_test.go
+++ b/internal/gitaly/service/commit/count_commits_test.go
@@ -5,12 +5,12 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestSuccessfulCountCommitsRequest(t *testing.T) {
@@ -145,13 +145,13 @@ func TestSuccessfulCountCommitsRequest(t *testing.T) {
if testCase.before != "" {
before, err := time.Parse(time.RFC3339, testCase.before)
require.NoError(t, err)
- request.Before = &timestamp.Timestamp{Seconds: before.Unix()}
+ request.Before = &timestamppb.Timestamp{Seconds: before.Unix()}
}
if testCase.after != "" {
after, err := time.Parse(time.RFC3339, testCase.after)
require.NoError(t, err)
- request.After = &timestamp.Timestamp{Seconds: after.Unix()}
+ request.After = &timestamppb.Timestamp{Seconds: after.Unix()}
}
if testCase.maxCount != 0 {
diff --git a/internal/gitaly/service/commit/find_commit_test.go b/internal/gitaly/service/commit/find_commit_test.go
index 86edbd59a..9829a5517 100644
--- a/internal/gitaly/service/commit/find_commit_test.go
+++ b/internal/gitaly/service/commit/find_commit_test.go
@@ -5,7 +5,6 @@ import (
"strings"
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -17,6 +16,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestSuccessfulFindCommitRequest(t *testing.T) {
@@ -60,13 +60,13 @@ func TestSuccessfulFindCommitRequest(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491261},
+ Date: &timestamppb.Timestamp{Seconds: 1393491261},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491261},
+ Date: &timestamppb.Timestamp{Seconds: 1393491261},
Timezone: []byte("+0200"),
},
ParentIds: []string{"d14d6c0abdd253381df51a723d58691b2ee1ab08"},
@@ -86,13 +86,13 @@ func TestSuccessfulFindCommitRequest(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491261},
+ Date: &timestamppb.Timestamp{Seconds: 1393491261},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491261},
+ Date: &timestamppb.Timestamp{Seconds: 1393491261},
Timezone: []byte("+0200"),
},
ParentIds: []string{"d14d6c0abdd253381df51a723d58691b2ee1ab08"},
@@ -128,13 +128,13 @@ func TestSuccessfulFindCommitRequest(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491261},
+ Date: &timestamppb.Timestamp{Seconds: 1393491261},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491261},
+ Date: &timestamppb.Timestamp{Seconds: 1393491261},
Timezone: []byte("+0200"),
},
ParentIds: []string{"d14d6c0abdd253381df51a723d58691b2ee1ab08"},
@@ -159,13 +159,13 @@ func TestSuccessfulFindCommitRequest(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Jacob Vosmaer"),
Email: []byte("jacob@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1512132977},
+ Date: &timestamppb.Timestamp{Seconds: 1512132977},
Timezone: []byte("+0100"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Jacob Vosmaer"),
Email: []byte("jacob@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1512132977},
+ Date: &timestamppb.Timestamp{Seconds: 1512132977},
Timezone: []byte("+0100"),
},
ParentIds: []string{"e63f41fe459e62e1228fcef60d7189127aeba95a"},
@@ -183,13 +183,13 @@ func TestSuccessfulFindCommitRequest(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Jacob Vosmaer"),
Email: []byte("jacob@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1517328273},
+ Date: &timestamppb.Timestamp{Seconds: 1517328273},
Timezone: []byte("+0100"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Jacob Vosmaer"),
Email: []byte("jacob@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1517328273},
+ Date: &timestamppb.Timestamp{Seconds: 1517328273},
Timezone: []byte("+0100"),
},
ParentIds: []string{"60ecb67744cb56576c30214ff52294f8ce2def98"},
@@ -206,13 +206,13 @@ func TestSuccessfulFindCommitRequest(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: bigCommit.Author.Date.Seconds},
+ Date: &timestamppb.Timestamp{Seconds: bigCommit.Author.Date.Seconds},
Timezone: []byte("+0100"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: bigCommit.Committer.Date.Seconds},
+ Date: &timestamppb.Timestamp{Seconds: bigCommit.Committer.Date.Seconds},
Timezone: []byte("+0100"),
},
ParentIds: []string{"60ecb67744cb56576c30214ff52294f8ce2def98"},
diff --git a/internal/gitaly/service/commit/find_commits_test.go b/internal/gitaly/service/commit/find_commits_test.go
index 726c7e154..c7c69b93e 100644
--- a/internal/gitaly/service/commit/find_commits_test.go
+++ b/internal/gitaly/service/commit/find_commits_test.go
@@ -7,7 +7,6 @@ import (
"os/exec"
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -15,6 +14,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestFindCommitsFields(t *testing.T) {
@@ -41,13 +41,13 @@ func TestFindCommitsFields(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Jacob Vosmaer"),
Email: []byte("jacob@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1512132977},
+ Date: &timestamppb.Timestamp{Seconds: 1512132977},
Timezone: []byte("+0100"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Jacob Vosmaer"),
Email: []byte("jacob@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1512132977},
+ Date: &timestamppb.Timestamp{Seconds: 1512132977},
Timezone: []byte("+0100"),
},
ParentIds: []string{"e63f41fe459e62e1228fcef60d7189127aeba95a"},
@@ -77,13 +77,13 @@ func TestFindCommitsFields(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491698},
+ Date: &timestamppb.Timestamp{Seconds: 1393491698},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491698},
+ Date: &timestamppb.Timestamp{Seconds: 1393491698},
Timezone: []byte("+0200"),
},
ParentIds: []string{"570e7b2abdd848b95f2f578043fc23bd6f6fd24d"},
@@ -102,13 +102,13 @@ func TestFindCommitsFields(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491698},
+ Date: &timestamppb.Timestamp{Seconds: 1393491698},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491698},
+ Date: &timestamppb.Timestamp{Seconds: 1393491698},
Timezone: []byte("+0200"),
},
ParentIds: []string{"570e7b2abdd848b95f2f578043fc23bd6f6fd24d"},
@@ -132,13 +132,13 @@ func TestFindCommitsFields(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Alejandro Rodríguez"),
Email: []byte("alejorro70@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1504382739},
+ Date: &timestamppb.Timestamp{Seconds: 1504382739},
Timezone: []byte("+0000"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Drew Blessing"),
Email: []byte("drew@blessing.io"),
- Date: &timestamp.Timestamp{Seconds: 1540823671},
+ Date: &timestamppb.Timestamp{Seconds: 1540823671},
Timezone: []byte("+0000"),
},
ParentIds: []string{"7975be0116940bf2ad4321f79d02a55c5f7779aa"},
@@ -268,8 +268,8 @@ func TestSuccessfulFindCommitsRequest(t *testing.T) {
desc: "before and after",
request: &gitalypb.FindCommitsRequest{
Repository: repo,
- Before: &timestamp.Timestamp{Seconds: 1483225200},
- After: &timestamp.Timestamp{Seconds: 1472680800},
+ Before: &timestamppb.Timestamp{Seconds: 1483225200},
+ After: &timestamppb.Timestamp{Seconds: 1472680800},
Limit: 10,
},
ids: []string{
diff --git a/internal/gitaly/service/commit/list_all_commits_test.go b/internal/gitaly/service/commit/list_all_commits_test.go
index 10abb0cad..f31d35030 100644
--- a/internal/gitaly/service/commit/list_all_commits_test.go
+++ b/internal/gitaly/service/commit/list_all_commits_test.go
@@ -9,13 +9,13 @@ import (
"path/filepath"
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestListAllCommits(t *testing.T) {
@@ -151,13 +151,13 @@ func TestListAllCommits(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("John Doe"),
Email: []byte("john.doe@example.com"),
- Date: &timestamp.Timestamp{Seconds: 1600000000},
+ Date: &timestamppb.Timestamp{Seconds: 1600000000},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("John Doe"),
Email: []byte("john.doe@example.com"),
- Date: &timestamp.Timestamp{Seconds: 1600000001},
+ Date: &timestamppb.Timestamp{Seconds: 1600000001},
Timezone: []byte("+0200"),
},
}}, receiveCommits(t, stream))
diff --git a/internal/gitaly/service/commit/list_commits_test.go b/internal/gitaly/service/commit/list_commits_test.go
index eafce92cb..166fc5ea3 100644
--- a/internal/gitaly/service/commit/list_commits_test.go
+++ b/internal/gitaly/service/commit/list_commits_test.go
@@ -5,12 +5,12 @@ import (
"io"
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestListCommits(t *testing.T) {
@@ -245,10 +245,10 @@ func TestListCommits(t *testing.T) {
Revisions: []string{
"0031876facac3f2b2702a0e53a26e89939a42209",
},
- After: &timestamp.Timestamp{
+ After: &timestamppb.Timestamp{
Seconds: 1393488197,
},
- Before: &timestamp.Timestamp{
+ Before: &timestamppb.Timestamp{
Seconds: 1393488199,
},
},
diff --git a/internal/gitaly/service/commit/testhelper_test.go b/internal/gitaly/service/commit/testhelper_test.go
index 28eef0f78..dac14fcb6 100644
--- a/internal/gitaly/service/commit/testhelper_test.go
+++ b/internal/gitaly/service/commit/testhelper_test.go
@@ -5,7 +5,6 @@ import (
"os"
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
@@ -15,6 +14,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestMain(m *testing.M) {
@@ -94,7 +94,7 @@ func dummyCommitAuthor(ts int64) *gitalypb.CommitAuthor {
return &gitalypb.CommitAuthor{
Name: []byte("Ahmad Sherif"),
Email: []byte("ahmad+gitlab-test@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: ts},
+ Date: &timestamppb.Timestamp{Seconds: ts},
Timezone: []byte("+0200"),
}
}
diff --git a/internal/gitaly/service/conflicts/resolve_conflicts.go b/internal/gitaly/service/conflicts/resolve_conflicts.go
index 155d641be..4eaeb6e95 100644
--- a/internal/gitaly/service/conflicts/resolve_conflicts.go
+++ b/internal/gitaly/service/conflicts/resolve_conflicts.go
@@ -11,7 +11,6 @@ import (
"strings"
"time"
- "github.com/golang/protobuf/ptypes"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/conflict"
@@ -176,10 +175,7 @@ func (s *server) resolveConflicts(header *gitalypb.ResolveConflictsRequestHeader
authorDate := time.Now()
if header.Timestamp != nil {
- authorDate, err = ptypes.Timestamp(header.Timestamp)
- if err != nil {
- return helper.ErrInvalidArgument(err)
- }
+ authorDate = header.Timestamp.AsTime()
}
if git.ValidateObjectID(header.GetOurCommitOid()) != nil ||
diff --git a/internal/gitaly/service/conflicts/resolve_conflicts_test.go b/internal/gitaly/service/conflicts/resolve_conflicts_test.go
index 0193fe573..cf9bf40d5 100644
--- a/internal/gitaly/service/conflicts/resolve_conflicts_test.go
+++ b/internal/gitaly/service/conflicts/resolve_conflicts_test.go
@@ -13,7 +13,6 @@ import (
"strings"
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -26,6 +25,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
var (
@@ -578,7 +578,7 @@ func testResolveConflictsStableID(t *testing.T, ctx context.Context) {
SourceBranch: []byte("conflict-resolvable"),
TargetBranch: []byte("conflict-start"),
User: user,
- Timestamp: &timestamp.Timestamp{Seconds: 12345},
+ Timestamp: &timestamppb.Timestamp{Seconds: 12345},
},
},
}))
@@ -610,13 +610,13 @@ func testResolveConflictsStableID(t *testing.T, ctx context.Context) {
Author: &gitalypb.CommitAuthor{
Name: user.Name,
Email: user.Email,
- Date: &timestamp.Timestamp{Seconds: 12345},
+ Date: &timestamppb.Timestamp{Seconds: 12345},
Timezone: []byte("+0000"),
},
Committer: &gitalypb.CommitAuthor{
Name: user.Name,
Email: user.Email,
- Date: &timestamp.Timestamp{Seconds: 12345},
+ Date: &timestamppb.Timestamp{Seconds: 12345},
Timezone: []byte("+0000"),
},
}, resolvedCommit)
@@ -920,7 +920,7 @@ func testResolveConflictsQuarantine(t *testing.T, ctx context.Context) {
SourceBranch: []byte("source"),
TargetBranch: []byte("target"),
User: user,
- Timestamp: &timestamp.Timestamp{Seconds: 12345},
+ Timestamp: &timestamppb.Timestamp{Seconds: 12345},
},
},
}))
diff --git a/internal/gitaly/service/operations/cherry_pick.go b/internal/gitaly/service/operations/cherry_pick.go
index 86bf6c593..b6353db12 100644
--- a/internal/gitaly/service/operations/cherry_pick.go
+++ b/internal/gitaly/service/operations/cherry_pick.go
@@ -6,7 +6,6 @@ import (
"fmt"
"time"
- "github.com/golang/protobuf/ptypes"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/updateref"
"gitlab.com/gitlab-org/gitaly/v14/internal/git2go"
@@ -44,10 +43,7 @@ func (s *Server) UserCherryPick(ctx context.Context, req *gitalypb.UserCherryPic
committerDate := time.Now()
if req.Timestamp != nil {
- committerDate, err = ptypes.Timestamp(req.Timestamp)
- if err != nil {
- return nil, err
- }
+ committerDate = req.Timestamp.AsTime()
}
newrev, err := s.git2go.CherryPick(ctx, localRepo, git2go.CherryPickCommand{
diff --git a/internal/gitaly/service/operations/cherry_pick_test.go b/internal/gitaly/service/operations/cherry_pick_test.go
index 5f1adf889..46678e761 100644
--- a/internal/gitaly/service/operations/cherry_pick_test.go
+++ b/internal/gitaly/service/operations/cherry_pick_test.go
@@ -4,7 +4,6 @@ import (
"fmt"
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -13,6 +12,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestServer_UserCherryPick_successful(t *testing.T) {
@@ -231,7 +231,7 @@ func TestServer_UserCherryPick_stableID(t *testing.T) {
Commit: commitToPick,
BranchName: []byte(destinationBranch),
Message: []byte("Cherry-picking " + commitToPick.Id),
- Timestamp: &timestamp.Timestamp{Seconds: 12345},
+ Timestamp: &timestamppb.Timestamp{Seconds: 12345},
}
response, err := client.UserCherryPick(ctx, request)
@@ -251,7 +251,7 @@ func TestServer_UserCherryPick_stableID(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Ahmad Sherif"),
Email: []byte("me@ahmadsherif.com"),
- Date: &timestamp.Timestamp{
+ Date: &timestamppb.Timestamp{
Seconds: 1487337076,
},
Timezone: []byte("+0200"),
@@ -259,7 +259,7 @@ func TestServer_UserCherryPick_stableID(t *testing.T) {
Committer: &gitalypb.CommitAuthor{
Name: gittest.TestUser.Name,
Email: gittest.TestUser.Email,
- Date: &timestamp.Timestamp{
+ Date: &timestamppb.Timestamp{
Seconds: 12345,
},
Timezone: []byte("+0000"),
diff --git a/internal/gitaly/service/operations/commit_files_test.go b/internal/gitaly/service/operations/commit_files_test.go
index a567db3bf..fa2e1a430 100644
--- a/internal/gitaly/service/operations/commit_files_test.go
+++ b/internal/gitaly/service/operations/commit_files_test.go
@@ -10,7 +10,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -989,13 +988,13 @@ func TestUserCommitFilesStableCommitID(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Author Name"),
Email: []byte("author.email@example.com"),
- Date: &timestamp.Timestamp{Seconds: 12345},
+ Date: &timestamppb.Timestamp{Seconds: 12345},
Timezone: []byte(gittest.TimezoneOffset),
},
Committer: &gitalypb.CommitAuthor{
Name: gittest.TestUser.Name,
Email: gittest.TestUser.Email,
- Date: &timestamp.Timestamp{Seconds: 12345},
+ Date: &timestamppb.Timestamp{Seconds: 12345},
Timezone: []byte(gittest.TimezoneOffset),
},
}, commit)
diff --git a/internal/gitaly/service/operations/merge_test.go b/internal/gitaly/service/operations/merge_test.go
index 5a5dd5f75..b91846b69 100644
--- a/internal/gitaly/service/operations/merge_test.go
+++ b/internal/gitaly/service/operations/merge_test.go
@@ -10,7 +10,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -22,6 +21,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
var (
@@ -133,7 +133,7 @@ func TestSuccessfulMerge_stableMergeIDs(t *testing.T) {
CommitId: commitToMerge,
Branch: []byte(mergeBranchName),
Message: []byte("Merged by Gitaly"),
- Timestamp: &timestamp.Timestamp{Seconds: 12, Nanos: 34},
+ Timestamp: &timestamppb.Timestamp{Seconds: 12, Nanos: 34},
}
// Because the timestamp is
@@ -170,14 +170,14 @@ func TestSuccessfulMerge_stableMergeIDs(t *testing.T) {
Name: gittest.TestUser.Name,
Email: gittest.TestUser.Email,
// Nanoseconds get ignored because commit timestamps aren't that granular.
- Date: &timestamp.Timestamp{Seconds: 12},
+ Date: &timestamppb.Timestamp{Seconds: 12},
Timezone: []byte(gittest.TimezoneOffset),
},
Committer: &gitalypb.CommitAuthor{
Name: gittest.TestUser.Name,
Email: gittest.TestUser.Email,
// Nanoseconds get ignored because commit timestamps aren't that granular.
- Date: &timestamp.Timestamp{Seconds: 12},
+ Date: &timestamppb.Timestamp{Seconds: 12},
Timezone: []byte(gittest.TimezoneOffset),
},
})
@@ -862,7 +862,7 @@ func TestUserMergeToRef_stableMergeID(t *testing.T) {
TargetRef: []byte("refs/merge-requests/x/written"),
SourceSha: "1450cd639e0bc6721eb02800169e464f212cde06",
Message: []byte("Merge message"),
- Timestamp: &timestamp.Timestamp{Seconds: 12, Nanos: 34},
+ Timestamp: &timestamppb.Timestamp{Seconds: 12, Nanos: 34},
})
require.NoError(t, err)
require.Equal(t, "c7b65194ce2da804557582408ab94713983d0b70", response.CommitId)
@@ -883,14 +883,14 @@ func TestUserMergeToRef_stableMergeID(t *testing.T) {
Name: gittest.TestUser.Name,
Email: gittest.TestUser.Email,
// Nanoseconds get ignored because commit timestamps aren't that granular.
- Date: &timestamp.Timestamp{Seconds: 12},
+ Date: &timestamppb.Timestamp{Seconds: 12},
Timezone: []byte(gittest.TimezoneOffset),
},
Committer: &gitalypb.CommitAuthor{
Name: gittest.TestUser.Name,
Email: gittest.TestUser.Email,
// Nanoseconds get ignored because commit timestamps aren't that granular.
- Date: &timestamp.Timestamp{Seconds: 12},
+ Date: &timestamppb.Timestamp{Seconds: 12},
Timezone: []byte(gittest.TimezoneOffset),
},
}, commit)
diff --git a/internal/gitaly/service/operations/rebase.go b/internal/gitaly/service/operations/rebase.go
index af530206e..543434749 100644
--- a/internal/gitaly/service/operations/rebase.go
+++ b/internal/gitaly/service/operations/rebase.go
@@ -7,7 +7,6 @@ import (
"fmt"
"time"
- "github.com/golang/protobuf/ptypes"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/updateref"
"gitlab.com/gitlab-org/gitaly/v14/internal/git2go"
@@ -54,10 +53,7 @@ func (s *Server) UserRebaseConfirmable(stream gitalypb.OperationService_UserReba
committer := git2go.NewSignature(string(header.User.Name), string(header.User.Email), time.Now())
if header.Timestamp != nil {
- committer.When, err = ptypes.Timestamp(header.Timestamp)
- if err != nil {
- return helper.ErrInvalidArgumentf("parse timestamp: %w", err)
- }
+ committer.When = header.Timestamp.AsTime()
}
newrev, err := s.git2go.Rebase(ctx, repo, git2go.RebaseCommand{
diff --git a/internal/gitaly/service/operations/rebase_test.go b/internal/gitaly/service/operations/rebase_test.go
index 1d4388a8b..b1bdd5855 100644
--- a/internal/gitaly/service/operations/rebase_test.go
+++ b/internal/gitaly/service/operations/rebase_test.go
@@ -10,7 +10,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -27,6 +26,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
"google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
var (
@@ -195,7 +195,7 @@ func TestUserRebaseConfirmableStableCommitIDs(t *testing.T) {
rebaseStream, err := client.UserRebaseConfirmable(ctx)
require.NoError(t, err)
- committerDate := &timestamp.Timestamp{Seconds: 100000000}
+ committerDate := &timestamppb.Timestamp{Seconds: 100000000}
parentSha := getBranchSha(t, cfg, repoPath, "master")
require.NoError(t, rebaseStream.Send(&gitalypb.UserRebaseConfirmableRequest{
@@ -240,7 +240,7 @@ func TestUserRebaseConfirmableStableCommitIDs(t *testing.T) {
Name: []byte("Drew Blessing"),
Email: []byte("drew@gitlab.com"),
// Nanoseconds get ignored because commit timestamps aren't that granular.
- Date: &timestamp.Timestamp{Seconds: 1510610637},
+ Date: &timestamppb.Timestamp{Seconds: 1510610637},
Timezone: []byte("-0600"),
},
Committer: &gitalypb.CommitAuthor{
diff --git a/internal/gitaly/service/operations/revert_test.go b/internal/gitaly/service/operations/revert_test.go
index 4eb491b12..58a263f77 100644
--- a/internal/gitaly/service/operations/revert_test.go
+++ b/internal/gitaly/service/operations/revert_test.go
@@ -3,7 +3,6 @@ package operations
import (
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -11,6 +10,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestServer_UserRevert_successful(t *testing.T) {
@@ -188,7 +188,7 @@ func TestServer_UserRevert_stableID(t *testing.T) {
Commit: commitToRevert,
BranchName: []byte("master"),
Message: []byte("Reverting commit"),
- Timestamp: &timestamp.Timestamp{Seconds: 12345},
+ Timestamp: &timestamppb.Timestamp{Seconds: 12345},
})
require.NoError(t, err)
@@ -213,13 +213,13 @@ func TestServer_UserRevert_stableID(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Jane Doe"),
Email: []byte("janedoe@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 12345},
+ Date: &timestamppb.Timestamp{Seconds: 12345},
Timezone: []byte(gittest.TimezoneOffset),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Jane Doe"),
Email: []byte("janedoe@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 12345},
+ Date: &timestamppb.Timestamp{Seconds: 12345},
Timezone: []byte(gittest.TimezoneOffset),
},
}, revertedCommit)
diff --git a/internal/gitaly/service/operations/squash_test.go b/internal/gitaly/service/operations/squash_test.go
index 1c69b7882..05a3e192f 100644
--- a/internal/gitaly/service/operations/squash_test.go
+++ b/internal/gitaly/service/operations/squash_test.go
@@ -9,7 +9,6 @@ import (
"strings"
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -21,6 +20,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
var (
@@ -108,7 +108,7 @@ func testUserSquashStableID(t *testing.T, ctx context.Context) {
CommitMessage: []byte("Squashed commit"),
StartSha: startSha,
EndSha: endSha,
- Timestamp: &timestamp.Timestamp{Seconds: 1234512345},
+ Timestamp: &timestamppb.Timestamp{Seconds: 1234512345},
})
require.NoError(t, err)
require.Empty(t, response.GetGitError())
@@ -127,13 +127,13 @@ func testUserSquashStableID(t *testing.T, ctx context.Context) {
Author: &gitalypb.CommitAuthor{
Name: author.Name,
Email: author.Email,
- Date: &timestamp.Timestamp{Seconds: 1234512345},
+ Date: &timestamppb.Timestamp{Seconds: 1234512345},
Timezone: []byte(gittest.TimezoneOffset),
},
Committer: &gitalypb.CommitAuthor{
Name: gittest.TestUser.Name,
Email: gittest.TestUser.Email,
- Date: &timestamp.Timestamp{Seconds: 1234512345},
+ Date: &timestamppb.Timestamp{Seconds: 1234512345},
Timezone: []byte(gittest.TimezoneOffset),
},
}, commit)
@@ -489,7 +489,7 @@ func TestUserSquash_ancestry(t *testing.T) {
CommitMessage: commitMessage,
StartSha: commit1.String(),
EndSha: commit2.String(),
- Timestamp: &timestamp.Timestamp{Seconds: 1234512345},
+ Timestamp: &timestamppb.Timestamp{Seconds: 1234512345},
})
require.Nil(t, err)
diff --git a/internal/gitaly/service/operations/submodules_test.go b/internal/gitaly/service/operations/submodules_test.go
index f19dfc70a..0b9d743fa 100644
--- a/internal/gitaly/service/operations/submodules_test.go
+++ b/internal/gitaly/service/operations/submodules_test.go
@@ -5,7 +5,6 @@ import (
"fmt"
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -14,6 +13,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestSuccessfulUserUpdateSubmoduleRequest(t *testing.T) {
@@ -114,7 +114,7 @@ func TestUserUpdateSubmoduleStableID(t *testing.T) {
CommitSha: "41fa1bc9e0f0630ced6a8a211d60c2af425ecc2d",
Branch: []byte("master"),
CommitMessage: []byte("Update Submodule message"),
- Timestamp: &timestamp.Timestamp{Seconds: 12345},
+ Timestamp: &timestamppb.Timestamp{Seconds: 12345},
})
require.NoError(t, err)
require.Empty(t, response.GetCommitError())
@@ -134,13 +134,13 @@ func TestUserUpdateSubmoduleStableID(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: gittest.TestUser.Name,
Email: gittest.TestUser.Email,
- Date: &timestamp.Timestamp{Seconds: 12345},
+ Date: &timestamppb.Timestamp{Seconds: 12345},
Timezone: []byte(gittest.TimezoneOffset),
},
Committer: &gitalypb.CommitAuthor{
Name: gittest.TestUser.Name,
Email: gittest.TestUser.Email,
- Date: &timestamp.Timestamp{Seconds: 12345},
+ Date: &timestamppb.Timestamp{Seconds: 12345},
Timezone: []byte(gittest.TimezoneOffset),
},
}, commit)
diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go
index 33e5660b2..61b631606 100644
--- a/internal/gitaly/service/operations/tags_test.go
+++ b/internal/gitaly/service/operations/tags_test.go
@@ -9,7 +9,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/backchannel"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
@@ -874,7 +873,7 @@ func TestUserCreateTagStableTagIDs(t *testing.T) {
TargetRevision: []byte("dfaa3f97ca337e20154a98ac9d0be76ddd1fcc82"),
Message: []byte("my message"),
User: gittest.TestUser,
- Timestamp: &timestamp.Timestamp{Seconds: 12345},
+ Timestamp: &timestamppb.Timestamp{Seconds: 12345},
})
require.NoError(t, err)
diff --git a/internal/gitaly/service/operations/utils.go b/internal/gitaly/service/operations/utils.go
index 63d95ddc7..9953fe4db 100644
--- a/internal/gitaly/service/operations/utils.go
+++ b/internal/gitaly/service/operations/utils.go
@@ -4,7 +4,6 @@ import (
"fmt"
"time"
- "github.com/golang/protobuf/ptypes"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/protobuf/types/known/timestamppb"
)
@@ -45,11 +44,7 @@ func dateFromProto(p userTimestampProto) (time.Time, error) {
date := time.Now()
if timestamp := p.GetTimestamp(); timestamp != nil {
- var err error
- date, err = ptypes.Timestamp(timestamp)
- if err != nil {
- return time.Time{}, err
- }
+ date = timestamp.AsTime()
}
if user := p.GetUser(); user != nil {
diff --git a/internal/gitaly/service/ref/refnames.go b/internal/gitaly/service/ref/refnames.go
index 3ed19a18f..087bdc317 100644
--- a/internal/gitaly/service/ref/refnames.go
+++ b/internal/gitaly/service/ref/refnames.go
@@ -4,11 +4,11 @@ import (
"bufio"
"context"
- "github.com/golang/protobuf/ptypes/wrappers"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/chunk"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/types/known/wrapperspb"
)
// FindAllBranchNames creates a stream of ref names for all branches in the given repository
@@ -25,7 +25,7 @@ type findAllBranchNamesSender struct {
func (ts *findAllBranchNamesSender) Reset() { ts.branchNames = nil }
func (ts *findAllBranchNamesSender) Append(m proto.Message) {
- ts.branchNames = append(ts.branchNames, []byte(m.(*wrappers.StringValue).Value))
+ ts.branchNames = append(ts.branchNames, []byte(m.(*wrapperspb.StringValue).Value))
}
func (ts *findAllBranchNamesSender) Send() error {
@@ -46,7 +46,7 @@ type findAllTagNamesSender struct {
func (ts *findAllTagNamesSender) Reset() { ts.tagNames = nil }
func (ts *findAllTagNamesSender) Append(m proto.Message) {
- ts.tagNames = append(ts.tagNames, []byte(m.(*wrappers.StringValue).Value))
+ ts.tagNames = append(ts.tagNames, []byte(m.(*wrapperspb.StringValue).Value))
}
func (ts *findAllTagNamesSender) Send() error {
@@ -76,7 +76,7 @@ func (s *server) listRefNames(ctx context.Context, chunker *chunk.Chunker, prefi
// Important: don't use scanner.Bytes() because the slice will become
// invalid on the next loop iteration. Instead, use scanner.Text() to
// force a copy.
- if err := chunker.Send(&wrappers.StringValue{Value: scanner.Text()}); err != nil {
+ if err := chunker.Send(&wrapperspb.StringValue{Value: scanner.Text()}); err != nil {
return err
}
}
diff --git a/internal/gitaly/service/ref/refnames_containing.go b/internal/gitaly/service/ref/refnames_containing.go
index 025545ea0..851a5a5fc 100644
--- a/internal/gitaly/service/ref/refnames_containing.go
+++ b/internal/gitaly/service/ref/refnames_containing.go
@@ -4,12 +4,12 @@ import (
"fmt"
"strings"
- "github.com/golang/protobuf/ptypes/wrappers"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/chunk"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/types/known/wrapperspb"
)
// ListBranchNamesContainingCommit returns a maximum of in.GetLimit() Branch names
@@ -48,7 +48,7 @@ type branchNamesContainingCommitSender struct {
func (bs *branchNamesContainingCommitSender) Reset() { bs.branchNames = nil }
func (bs *branchNamesContainingCommitSender) Append(m proto.Message) {
- bs.branchNames = append(bs.branchNames, stripPrefix(m.(*wrappers.StringValue).Value, "refs/heads/"))
+ bs.branchNames = append(bs.branchNames, stripPrefix(m.(*wrapperspb.StringValue).Value, "refs/heads/"))
}
func (bs *branchNamesContainingCommitSender) Send() error {
@@ -78,7 +78,7 @@ type tagNamesContainingCommitSender struct {
func (ts *tagNamesContainingCommitSender) Reset() { ts.tagNames = nil }
func (ts *tagNamesContainingCommitSender) Append(m proto.Message) {
- ts.tagNames = append(ts.tagNames, stripPrefix(m.(*wrappers.StringValue).Value, "refs/tags/"))
+ ts.tagNames = append(ts.tagNames, stripPrefix(m.(*wrapperspb.StringValue).Value, "refs/tags/"))
}
func (ts *tagNamesContainingCommitSender) Send() error {
diff --git a/internal/gitaly/service/ref/refs_test.go b/internal/gitaly/service/ref/refs_test.go
index 5a49d6edf..0b9582d5d 100644
--- a/internal/gitaly/service/ref/refs_test.go
+++ b/internal/gitaly/service/ref/refs_test.go
@@ -11,7 +11,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
@@ -501,7 +500,7 @@ func testSuccessfulFindAllTagsRequest(t *testing.T, ctx context.Context) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
},
@@ -514,7 +513,7 @@ func testSuccessfulFindAllTagsRequest(t *testing.T, ctx context.Context) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
},
@@ -527,7 +526,7 @@ func testSuccessfulFindAllTagsRequest(t *testing.T, ctx context.Context) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491299},
+ Date: &timestamppb.Timestamp{Seconds: 1393491299},
Timezone: []byte("+0200"),
},
},
@@ -540,7 +539,7 @@ func testSuccessfulFindAllTagsRequest(t *testing.T, ctx context.Context) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393505709},
+ Date: &timestamppb.Timestamp{Seconds: 1393505709},
Timezone: []byte("+0200"),
},
},
@@ -553,7 +552,7 @@ func testSuccessfulFindAllTagsRequest(t *testing.T, ctx context.Context) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Roger Meier"),
Email: []byte("r.meier@siemens.com"),
- Date: &timestamp.Timestamp{Seconds: 1574261780},
+ Date: &timestamppb.Timestamp{Seconds: 1574261780},
Timezone: []byte("+0100"),
},
SignatureType: gitalypb.SignatureType_X509,
@@ -567,7 +566,7 @@ func testSuccessfulFindAllTagsRequest(t *testing.T, ctx context.Context) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491261},
+ Date: &timestamppb.Timestamp{Seconds: 1393491261},
Timezone: []byte("+0100"),
},
SignatureType: gitalypb.SignatureType_PGP,
@@ -580,7 +579,7 @@ func testSuccessfulFindAllTagsRequest(t *testing.T, ctx context.Context) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
},
@@ -612,7 +611,7 @@ func testSuccessfulFindAllTagsRequest(t *testing.T, ctx context.Context) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
},
@@ -660,7 +659,7 @@ func TestFindAllTags_duplicateAnnotatedTags(t *testing.T) {
commitAuthor := &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
}
commit := &gitalypb.GitCommit{
@@ -776,7 +775,7 @@ func testFindAllTagNestedTags(t *testing.T, ctx context.Context) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
}
@@ -1061,13 +1060,13 @@ func TestSuccessfulFindAllBranchesRequest(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393488896},
+ Date: &timestamppb.Timestamp{Seconds: 1393488896},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393488896},
+ Date: &timestamppb.Timestamp{Seconds: 1393488896},
Timezone: []byte("+0200"),
},
SignatureType: gitalypb.SignatureType_PGP,
@@ -1449,7 +1448,7 @@ func TestSuccessfulFindTagRequest(t *testing.T) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
},
@@ -1462,7 +1461,7 @@ func TestSuccessfulFindTagRequest(t *testing.T) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
},
@@ -1475,7 +1474,7 @@ func TestSuccessfulFindTagRequest(t *testing.T) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491299},
+ Date: &timestamppb.Timestamp{Seconds: 1393491299},
Timezone: []byte("+0200"),
},
SignatureType: gitalypb.SignatureType_NONE,
@@ -1489,7 +1488,7 @@ func TestSuccessfulFindTagRequest(t *testing.T) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393505709},
+ Date: &timestamppb.Timestamp{Seconds: 1393505709},
Timezone: []byte("+0200"),
},
},
@@ -1502,7 +1501,7 @@ func TestSuccessfulFindTagRequest(t *testing.T) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Roger Meier"),
Email: []byte("r.meier@siemens.com"),
- Date: &timestamp.Timestamp{Seconds: 1574261780},
+ Date: &timestamppb.Timestamp{Seconds: 1574261780},
Timezone: []byte("+0100"),
},
SignatureType: gitalypb.SignatureType_X509,
@@ -1515,7 +1514,7 @@ func TestSuccessfulFindTagRequest(t *testing.T) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
},
@@ -1547,7 +1546,7 @@ func TestSuccessfulFindTagRequest(t *testing.T) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
},
@@ -1631,7 +1630,7 @@ func TestFindTagNestedTag(t *testing.T) {
Tagger: &gitalypb.CommitAuthor{
Name: []byte("Scrooge McDuck"),
Email: []byte("scrooge@mcduck.com"),
- Date: &timestamp.Timestamp{Seconds: 1572776879},
+ Date: &timestamppb.Timestamp{Seconds: 1572776879},
Timezone: []byte("+0100"),
},
}
diff --git a/internal/gitaly/service/ref/util_test.go b/internal/gitaly/service/ref/util_test.go
index 3aaee1697..c7203b539 100644
--- a/internal/gitaly/service/ref/util_test.go
+++ b/internal/gitaly/service/ref/util_test.go
@@ -3,9 +3,9 @@ package ref
import (
"testing"
- "github.com/golang/protobuf/ptypes/timestamp"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
func TestBuildLocalBranch(t *testing.T) {
@@ -23,13 +23,13 @@ func TestBuildLocalBranch(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
ParentIds: []string{
@@ -45,13 +45,13 @@ func TestBuildLocalBranch(t *testing.T) {
CommitAuthor: &gitalypb.FindLocalBranchCommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
CommitCommitter: &gitalypb.FindLocalBranchCommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
Commit: &gitalypb.GitCommit{
@@ -61,13 +61,13 @@ func TestBuildLocalBranch(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
ParentIds: []string{"1b12f15a11fc6e62177bef08f47bc7b5ce50b141", "498214de67004b1da3d820901307bed2a68a8ef6"},
@@ -84,7 +84,7 @@ func TestBuildLocalBranch(t *testing.T) {
Committer: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
ParentIds: []string{
@@ -101,7 +101,7 @@ func TestBuildLocalBranch(t *testing.T) {
CommitCommitter: &gitalypb.FindLocalBranchCommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
Commit: &gitalypb.GitCommit{
@@ -111,7 +111,7 @@ func TestBuildLocalBranch(t *testing.T) {
Committer: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
ParentIds: []string{"1b12f15a11fc6e62177bef08f47bc7b5ce50b141", "498214de67004b1da3d820901307bed2a68a8ef6"},
@@ -128,7 +128,7 @@ func TestBuildLocalBranch(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
ParentIds: []string{
@@ -144,7 +144,7 @@ func TestBuildLocalBranch(t *testing.T) {
CommitAuthor: &gitalypb.FindLocalBranchCommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
CommitCommitter: nil,
@@ -155,7 +155,7 @@ func TestBuildLocalBranch(t *testing.T) {
Author: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0200"),
},
ParentIds: []string{"1b12f15a11fc6e62177bef08f47bc7b5ce50b141", "498214de67004b1da3d820901307bed2a68a8ef6"},
diff --git a/internal/helper/chunk/chunker_test.go b/internal/helper/chunk/chunker_test.go
index c88084b2a..c7f91fd85 100644
--- a/internal/helper/chunk/chunker_test.go
+++ b/internal/helper/chunk/chunker_test.go
@@ -6,12 +6,12 @@ import (
"os"
"testing"
- "github.com/golang/protobuf/ptypes/wrappers"
"github.com/stretchr/testify/require"
test "gitlab.com/gitlab-org/gitaly/v14/internal/helper/chunk/testdata"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/types/known/wrapperspb"
)
func TestMain(m *testing.M) {
@@ -32,7 +32,7 @@ type testSender struct {
func (ts *testSender) Reset() { ts.output = nil }
func (ts *testSender) Append(m proto.Message) {
- ts.output = append(ts.output, m.(*wrappers.BytesValue).Value)
+ ts.output = append(ts.output, m.(*wrapperspb.BytesValue).Value)
}
func (ts *testSender) Send() error {
@@ -73,7 +73,7 @@ func (s *server) StreamOutput(req *test.StreamOutputRequest, srv test.Test_Strea
c := New(&testSender{stream: srv})
for numBytes := 0; numBytes < int(req.GetBytesToReturn()); numBytes += kilobyte {
- if err := c.Send(&wrappers.BytesValue{Value: make([]byte, kilobyte)}); err != nil {
+ if err := c.Send(&wrapperspb.BytesValue{Value: make([]byte, kilobyte)}); err != nil {
return err
}
}
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go
index 745f8ec2e..382366315 100644
--- a/internal/praefect/coordinator_test.go
+++ b/internal/praefect/coordinator_test.go
@@ -11,7 +11,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/empty"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/testutil"
"github.com/sirupsen/logrus"
@@ -46,6 +45,7 @@ import (
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/types/known/emptypb"
)
var testLogger = logrus.New()
@@ -1086,8 +1086,8 @@ func TestCoordinatorEnqueueFailure(t *testing.T) {
})
ms := &mockSvc{
- repoMutatorUnary: func(context.Context, *mock.RepoRequest) (*empty.Empty, error) {
- return &empty.Empty{}, nil // always succeeds
+ repoMutatorUnary: func(context.Context, *mock.RepoRequest) (*emptypb.Empty, error) {
+ return &emptypb.Empty{}, nil // always succeeds
},
}
diff --git a/internal/praefect/middleware/errorhandler_test.go b/internal/praefect/middleware/errorhandler_test.go
index 4c82d2092..fada40963 100644
--- a/internal/praefect/middleware/errorhandler_test.go
+++ b/internal/praefect/middleware/errorhandler_test.go
@@ -6,7 +6,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/empty"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper"
@@ -17,26 +16,27 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
"google.golang.org/grpc"
+ "google.golang.org/protobuf/types/known/emptypb"
)
type simpleService struct {
mock.UnimplementedSimpleServiceServer
}
-func (s *simpleService) RepoAccessorUnary(ctx context.Context, in *mock.RepoRequest) (*empty.Empty, error) {
+func (s *simpleService) RepoAccessorUnary(ctx context.Context, in *mock.RepoRequest) (*emptypb.Empty, error) {
if in.GetRepo() == nil {
return nil, helper.ErrInternalf("error")
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
}
-func (s *simpleService) RepoMutatorUnary(ctx context.Context, in *mock.RepoRequest) (*empty.Empty, error) {
+func (s *simpleService) RepoMutatorUnary(ctx context.Context, in *mock.RepoRequest) (*emptypb.Empty, error) {
if in.GetRepo() == nil {
return nil, helper.ErrInternalf("error")
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
}
func TestStreamInterceptor(t *testing.T) {
diff --git a/internal/praefect/mocksvc_test.go b/internal/praefect/mocksvc_test.go
index 993fdd027..69aa76ca6 100644
--- a/internal/praefect/mocksvc_test.go
+++ b/internal/praefect/mocksvc_test.go
@@ -3,13 +3,13 @@ package praefect
import (
"context"
- "github.com/golang/protobuf/ptypes/empty"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/mock"
+ "google.golang.org/protobuf/types/known/emptypb"
)
type (
- repoAccessorUnaryFunc func(context.Context, *mock.RepoRequest) (*empty.Empty, error)
- repoMutatorUnaryFunc func(context.Context, *mock.RepoRequest) (*empty.Empty, error)
+ repoAccessorUnaryFunc func(context.Context, *mock.RepoRequest) (*emptypb.Empty, error)
+ repoMutatorUnaryFunc func(context.Context, *mock.RepoRequest) (*emptypb.Empty, error)
)
// mockSvc is an implementation of mock.SimpleServer for testing purposes. The
@@ -21,11 +21,11 @@ type mockSvc struct {
}
// RepoAccessorUnary is implemented by a callback
-func (m *mockSvc) RepoAccessorUnary(ctx context.Context, req *mock.RepoRequest) (*empty.Empty, error) {
+func (m *mockSvc) RepoAccessorUnary(ctx context.Context, req *mock.RepoRequest) (*emptypb.Empty, error) {
return m.repoAccessorUnary(ctx, req)
}
// RepoMutatorUnary is implemented by a callback
-func (m *mockSvc) RepoMutatorUnary(ctx context.Context, req *mock.RepoRequest) (*empty.Empty, error) {
+func (m *mockSvc) RepoMutatorUnary(ctx context.Context, req *mock.RepoRequest) (*emptypb.Empty, error) {
return m.repoMutatorUnary(ctx, req)
}
diff --git a/internal/praefect/server_test.go b/internal/praefect/server_test.go
index f80fdb06b..d7ba38e5f 100644
--- a/internal/praefect/server_test.go
+++ b/internal/praefect/server_test.go
@@ -13,7 +13,6 @@ import (
"testing"
"time"
- "github.com/golang/protobuf/ptypes/empty"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"
@@ -51,6 +50,7 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/types/known/emptypb"
)
func TestNewBackchannelServerFactory(t *testing.T) {
@@ -851,29 +851,29 @@ func TestProxyWrites(t *testing.T) {
func TestErrorThreshold(t *testing.T) {
backendToken := ""
backend, cleanup := newMockDownstream(t, backendToken, &mockSvc{
- repoMutatorUnary: func(ctx context.Context, req *mock.RepoRequest) (*empty.Empty, error) {
+ repoMutatorUnary: func(ctx context.Context, req *mock.RepoRequest) (*emptypb.Empty, error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
- return &empty.Empty{}, errors.New("couldn't read metadata")
+ return &emptypb.Empty{}, errors.New("couldn't read metadata")
}
if md.Get("bad-header")[0] == "true" {
- return &empty.Empty{}, helper.ErrInternalf("something went wrong")
+ return &emptypb.Empty{}, helper.ErrInternalf("something went wrong")
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
},
- repoAccessorUnary: func(ctx context.Context, req *mock.RepoRequest) (*empty.Empty, error) {
+ repoAccessorUnary: func(ctx context.Context, req *mock.RepoRequest) (*emptypb.Empty, error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
- return &empty.Empty{}, errors.New("couldn't read metadata")
+ return &emptypb.Empty{}, errors.New("couldn't read metadata")
}
if md.Get("bad-header")[0] == "true" {
- return &empty.Empty{}, helper.ErrInternalf("something went wrong")
+ return &emptypb.Empty{}, helper.ErrInternalf("something went wrong")
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
},
})
defer cleanup()
diff --git a/internal/testhelper/gitlabtest.go b/internal/testhelper/gitlabtest.go
index f6a834ca9..0edf90043 100644
--- a/internal/testhelper/gitlabtest.go
+++ b/internal/testhelper/gitlabtest.go
@@ -1,8 +1,8 @@
package testhelper
import (
- "github.com/golang/protobuf/ptypes/timestamp"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
var (
@@ -19,13 +19,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0000"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Job van der Voort"),
Email: []byte("job@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1474987066},
+ Date: &timestamppb.Timestamp{Seconds: 1474987066},
Timezone: []byte("+0000"),
},
ParentIds: []string{
@@ -42,13 +42,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Sean McGivern"),
Email: []byte("sean@mcgivern.me.uk"),
- Date: &timestamp.Timestamp{Seconds: 1491906794},
+ Date: &timestamppb.Timestamp{Seconds: 1491906794},
Timezone: []byte("+0000"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Sean McGivern"),
Email: []byte("sean@mcgivern.me.uk"),
- Date: &timestamp.Timestamp{Seconds: 1491906794},
+ Date: &timestamppb.Timestamp{Seconds: 1491906794},
Timezone: []byte("+0000"),
},
ParentIds: []string{
@@ -65,13 +65,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Luke \"Jared\" Bennett"),
Email: []byte("lbennett@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1491905339},
+ Date: &timestamppb.Timestamp{Seconds: 1491905339},
Timezone: []byte("+0000"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Luke \"Jared\" Bennett"),
Email: []byte("lbennett@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1491905339},
+ Date: &timestamppb.Timestamp{Seconds: 1491905339},
Timezone: []byte("+0000"),
},
ParentIds: []string{"b83d6e391c22777fca1ed3012fce84f633d7fed0"},
@@ -86,13 +86,13 @@ var (
Name: []byte("Alejandro Rodríguez"),
Email: []byte("alejorro70@gmail.com"),
// Not the actual commit date, but the biggest we can represent
- Date: &timestamp.Timestamp{Seconds: 9223371974719179007},
+ Date: &timestamppb.Timestamp{Seconds: 9223371974719179007},
Timezone: []byte("+0000"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Alejandro Rodríguez"),
Email: []byte("alejorro70@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 9223371974719179007},
+ Date: &timestamppb.Timestamp{Seconds: 9223371974719179007},
Timezone: []byte("+0000"),
},
ParentIds: []string{"e63f41fe459e62e1228fcef60d7189127aeba95a"},
@@ -106,13 +106,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("tiagonbotelho"),
Email: []byte("tiagonbotelho@hotmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1474470806},
+ Date: &timestamppb.Timestamp{Seconds: 1474470806},
Timezone: []byte("+0100"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("tiagonbotelho"),
Email: []byte("tiagonbotelho@hotmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1474470806},
+ Date: &timestamppb.Timestamp{Seconds: 1474470806},
Timezone: []byte("+0100"),
},
ParentIds: []string{"1b12f15a11fc6e62177bef08f47bc7b5ce50b141"},
@@ -126,13 +126,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491261},
+ Date: &timestamppb.Timestamp{Seconds: 1393491261},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491261},
+ Date: &timestamppb.Timestamp{Seconds: 1393491261},
Timezone: []byte("+0200"),
},
ParentIds: []string{"d14d6c0abdd253381df51a723d58691b2ee1ab08"},
@@ -147,13 +147,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393488198},
+ Date: &timestamppb.Timestamp{Seconds: 1393488198},
Timezone: []byte("-0800"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393488198},
+ Date: &timestamppb.Timestamp{Seconds: 1393488198},
Timezone: []byte("-0800"),
},
ParentIds: nil,
@@ -167,13 +167,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Ruben Davila"),
Email: []byte("rdavila84@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1523247267},
+ Date: &timestamppb.Timestamp{Seconds: 1523247267},
Timezone: []byte("-0500"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Jacob Vosmaer"),
Email: []byte("jacob@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1527855450},
+ Date: &timestamppb.Timestamp{Seconds: 1527855450},
Timezone: []byte("+0200"),
},
ParentIds: []string{"60ecb67744cb56576c30214ff52294f8ce2def98"},
@@ -187,13 +187,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Jacob Vosmaer"),
Email: []byte("jacob@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1517328273},
+ Date: &timestamppb.Timestamp{Seconds: 1517328273},
Timezone: []byte("+0100"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Jacob Vosmaer"),
Email: []byte("jacob@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1517328273},
+ Date: &timestamppb.Timestamp{Seconds: 1517328273},
Timezone: []byte("+0100"),
},
ParentIds: []string{"60ecb67744cb56576c30214ff52294f8ce2def98"},
@@ -208,13 +208,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Roger Meier"),
Email: []byte("r.meier@siemens.com"),
- Date: &timestamp.Timestamp{Seconds: 1570810009},
+ Date: &timestamppb.Timestamp{Seconds: 1570810009},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Roger Meier"),
Email: []byte("r.meier@siemens.com"),
- Date: &timestamp.Timestamp{Seconds: 1570810009},
+ Date: &timestamppb.Timestamp{Seconds: 1570810009},
Timezone: []byte("+0200"),
},
ParentIds: []string{"0ad583fecb2fb1eaaadaf77d5a33bc69ec1061c1"},
@@ -229,13 +229,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491451},
+ Date: &timestamppb.Timestamp{Seconds: 1393491451},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491451},
+ Date: &timestamppb.Timestamp{Seconds: 1393491451},
Timezone: []byte("+0200"),
},
ParentIds: []string{"6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9"},
@@ -250,13 +250,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491698},
+ Date: &timestamppb.Timestamp{Seconds: 1393491698},
Timezone: []byte("+0200"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Dmitriy Zaporozhets"),
Email: []byte("dmitriy.zaporozhets@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1393491698},
+ Date: &timestamppb.Timestamp{Seconds: 1393491698},
Timezone: []byte("+0200"),
},
ParentIds: []string{"570e7b2abdd848b95f2f578043fc23bd6f6fd24d"},
@@ -273,13 +273,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Stan Hu"),
Email: []byte("stanhu@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1471558878},
+ Date: &timestamppb.Timestamp{Seconds: 1471558878},
Timezone: []byte("+0000"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Stan Hu"),
Email: []byte("stanhu@gmail.com"),
- Date: &timestamp.Timestamp{Seconds: 1471558878},
+ Date: &timestamppb.Timestamp{Seconds: 1471558878},
Timezone: []byte("+0000"),
},
TreeId: "23f60b6e4ff0c59039b42c8fc4d3f008abef3bee",
@@ -293,13 +293,13 @@ var (
Author: &gitalypb.CommitAuthor{
Name: []byte("Sytse Sijbrandij"),
Email: []byte("sytse@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1420925009},
+ Date: &timestamppb.Timestamp{Seconds: 1420925009},
Timezone: []byte("+0000"),
},
Committer: &gitalypb.CommitAuthor{
Name: []byte("Sytse Sijbrandij"),
Email: []byte("sytse@gitlab.com"),
- Date: &timestamp.Timestamp{Seconds: 1420925009},
+ Date: &timestamppb.Timestamp{Seconds: 1420925009},
Timezone: []byte("+0000"),
},
TreeId: "c56b5e763e885e1aed626da52a603ba740936ac2",