gitproto: extract transport interface and rename HTTPConn · Entire

gitproto: extract transport interface and rename HTTPConn

4961145→main·

Soph·2mo ago·18 files·+178 added/-137 removed

Sessions

f97b592d8e72View transcript

Changes

18

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

package gitproto

import (
    "context"
    "io"
    "net/url"
)

// Conn represents a connection to a Git remote transport such as Smart HTTP
// or SSH.
type Conn interface {
    RequestInfoRefs(ctx context.Context, service string, gitProtocol string) ([]byte, error)
    PostRPCStreamBody(ctx context.Context, service string, body io.Reader, v2 bool, phase string) (io.ReadCloser, error)
    Endpoint() *url.URL
    ProgressWriter() io.Writer
    SetProgressWriter(w io.Writer)
    Close() error
}

Minternal/gitproto/conn.go+18

// Caller must close the returned ReadCloser.
func (s *RefService) FetchToStore(
    ctx context.Context,
    store storer.Storer,
    conn *Conn,
    conn Conn,
    desired map[plumbing.ReferenceName]DesiredRef,
    targetRefs map[plumbing.ReferenceName]plumbing.Hash,
) error {
// Caller must close the returned ReadCloser.
func (s *RefService) FetchPack(
    ctx context.Context,
    conn *Conn,
    conn Conn,
    desired map[plumbing.ReferenceName]DesiredRef,
    targetRefs map[plumbing.ReferenceName]plumbing.Hash,
) (io.ReadCloser, error) {
// Caller must close the returned ReadCloser.
func (s *RefService) FetchCommitGraph(
    ctx context.Context,
    store storer.Storer,
    conn *Conn,
    conn Conn,
    ref DesiredRef,
    haves []plumbing.Hash,
) error {
// Caller must close the returned ReadCloser.
func (s *RefService) FetchPack(
    ctx context.Context,
    conn *Conn,
    conn Conn,
    desired map[plumbing.ReferenceName]DesiredRef,
    targetRefs map[plumbing.ReferenceName]plumbing.Hash,
) (io.ReadCloser, error) {