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:
authorJames Fargher <jfargher@gitlab.com>2021-11-16 23:56:13 +0300
committerJames Fargher <jfargher@gitlab.com>2021-12-02 23:43:28 +0300
commit74852d9e5418d937fd6dcf4f0f82daff7903a3fa (patch)
tree3c8a9e7126bb32f208d194a96b0510c335c5abd6
parent3da51560ddc36d06bc90c9e8ca20e5c5ed0160f9 (diff)
backup: Rename RefsDecoder to ShowRefsDecoder
In order to reuse the decoder we are looking to move this decoder into the git package but the existing name is a bit too generic. Here we're renaming it to be specific.
-rw-r--r--internal/backup/backup.go2
-rw-r--r--internal/backup/refs.go14
-rw-r--r--internal/backup/refs_test.go4
3 files changed, 10 insertions, 10 deletions
diff --git a/internal/backup/backup.go b/internal/backup/backup.go
index 23c29f2f9..016fb2e67 100644
--- a/internal/backup/backup.go
+++ b/internal/backup/backup.go
@@ -337,7 +337,7 @@ func (mgr *Manager) sendKnownRefs(ctx context.Context, step *Step, repo *gitalyp
}
defer reader.Close()
- d := NewRefsDecoder(reader)
+ d := NewShowRefDecoder(reader)
for {
var ref git.Reference
diff --git a/internal/backup/refs.go b/internal/backup/refs.go
index cbce8bc2e..1bb8eb9b7 100644
--- a/internal/backup/refs.go
+++ b/internal/backup/refs.go
@@ -9,22 +9,22 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
)
-// RefsDecoder parses the output format of git-show-ref
-type RefsDecoder struct {
+// ShowRefDecoder parses the output format of git-show-ref
+type ShowRefDecoder struct {
r *bufio.Reader
err error
}
-// NewRefsDecoder returns a new RefsDecoder
-func NewRefsDecoder(r io.Reader) *RefsDecoder {
- return &RefsDecoder{
+// NewShowRefDecoder returns a new ShowRefDecoder
+func NewShowRefDecoder(r io.Reader) *ShowRefDecoder {
+ return &ShowRefDecoder{
r: bufio.NewReader(r),
}
}
// Decode reads and parses the next reference. Returns io.EOF when the end of
// the reader has been reached.
-func (d *RefsDecoder) Decode(ref *git.Reference) error {
+func (d *ShowRefDecoder) Decode(ref *git.Reference) error {
if d.err != nil {
return d.err
}
@@ -41,7 +41,7 @@ func (d *RefsDecoder) Decode(ref *git.Reference) error {
if d.err != nil {
return d.err
}
- return fmt.Errorf("refs decoder: invalid line: %q", line)
+ return fmt.Errorf("show-ref decoder: invalid line: %q", line)
}
*ref = git.NewReference(git.ReferenceName(splits[1]), splits[0])
diff --git a/internal/backup/refs_test.go b/internal/backup/refs_test.go
index 3aa713f4b..3f78dfe19 100644
--- a/internal/backup/refs_test.go
+++ b/internal/backup/refs_test.go
@@ -13,7 +13,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
)
-func TestRefsDecoder(t *testing.T) {
+func TestShowRefDecoder(t *testing.T) {
cfg := testcfg.Build(t)
ctx, cancel := testhelper.Context()
@@ -31,7 +31,7 @@ func TestRefsDecoder(t *testing.T) {
output := gittest.Exec(t, cfg, "-C", repoPath, "show-ref")
stream := bytes.NewBuffer(output)
- d := NewRefsDecoder(stream)
+ d := NewShowRefDecoder(stream)
var refs []git.Reference
for {