Merge pull request #105 from entireio/bump-go-git · Entire

Merge pull request #105 from entireio/bump-go-git

298c7f1→main·

pjbgf·4d ago·7 files·+53 added/-26 removed

Bump go-git to latest for Git v2 fetches

Changes

7

7 unmodified lines

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
159 unmodified lines

190
191
192
186
193
194
195
196

7 unmodified lines

"io"
    "net/http"
    "net/http/httptest"
    "os"
    "testing"

git "github.com/go-git/go-git/v6"
    "github.com/go-git/go-git/v6/plumbing"
    "github.com/go-git/go-git/v6/plumbing/protocol"
    "github.com/go-git/go-git/v6/plumbing/protocol/packp"
    "github.com/go-git/go-git/v6/plumbing/transport"

"entire.io/entire/git-sync/internal/syncertest"
)

func TestMain(m *testing.M) {
    syncertest.IsolateGitConfig()
    os.Exit(m.Run())
}

type errAuthProvider struct{}

func (errAuthProvider) AuthFor(_ context.Context, _ Endpoint, _ EndpointRole) (EndpointAuth, error) {
159 unmodified lines

}

var buf bytes.Buffer
if err := transport.AdvertiseRefs(r.Context(), s.repo.Storer, &buf, service, false); err != nil {
if err := transport.AdvertiseRefs(r.Context(), s.repo.Storer, &buf, service, false, protocol.V0); err != nil {
    http.Error(w, err.Error(), http.StatusInternalServerError)
    return
}

Mclient_test.go+8/-1

23 unmodified lines

24
25
26
27
28
29
30
16 unmodified lines

47
48
49
50
51
52
53
759 unmodified lines

813
814
815
814
816
817
818
819

23 unmodified lines

"github.com/go-git/go-git/v6/plumbing"
    "github.com/go-git/go-git/v6/plumbing/format/pktline"
    "github.com/go-git/go-git/v6/plumbing/object"
    "github.com/go-git/go-git/v6/plumbing/protocol"
    "github.com/go-git/go-git/v6/plumbing/protocol/capability"
    "github.com/go-git/go-git/v6/plumbing/protocol/packp"
    "github.com/go-git/go-git/v6/plumbing/protocol/packp/sideband"
16 unmodified lines

// Tests that need to exercise helper behaviour explicitly should
// restore auth.GitCredentialCommand in their own setup.
func TestMain(m *testing.M) {
    syncertest.IsolateGitConfig()
    auth.GitCredentialCommand = func(_ context.Context, _ auth.CredentialOp, _ string) ([]byte, error) {
        return nil, errors.New("no helper configured (test default)")
    }
759 unmodified lines

}

Mcmd/git-sync/main_test.go+3/-1

4 unmodified lines

5 6 7 8 9 8 9 10 11 12 13 unmodified lines

26 27 28 29 30 29 30 31 32 33

4 unmodified lines

toolchain go1.26.2

require ( github.com/go-git/go-billy/v6 v6.0.0-alpha.1 github.com/go-git/go-git/v6 v6.0.0-alpha.4.0.20260521151600-590487407c38 github.com/go-git/go-billy/v6 v6.0.0-alpha.1.0.20260519112248-0095b064a6c6 github.com/go-git/go-git/v6 v6.0.0-alpha.4.0.20260713100844-d5e9b9c7895b github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.11.1 ) 13 unmodified lines

github.com/sergi/go-diff v1.4.0 // indirect github.com/spf13/pflag v1.0.9 // indirect golang.org/x/crypto v0.54.0 // indirect golang.org/x/net v0.56.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/net v0.57.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect )


Mgo.mod+4/-4

17 unmodified lines

18 19 20 21 22 21 22 23 24 25 26 25 26 27 28 29 23 unmodified lines

53 54 55 56 57 58 59 56 57 58 59 60 61 62

17 unmodified lines

github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= github.com/go-git/gcfg/v2 v2.0.2 h1:MY5SIIfTGGEMhdA7d7JePuVVxtKL7Hp+ApGDJAJ7dpo= github.com/go-git/gcfg/v2 v2.0.2/go.mod h1:/lv2NsxvhepuMrldsFilrgct6pxzpGdSRC13ydTLSLs= github.com/go-git/go-billy/v6 v6.0.0-alpha.1 h1:xVjAR4oUvrKy7/Xuw/lLlV3gkxR3KO2H8W+MamuVVsQ= github.com/go-git/go-billy/v6 v6.0.0-alpha.1/go.mod h1:eaCUpHbedW7//EwcYmUDfJe2N6sJC9O12AT0OTqJR1E= github.com/go-git/go-billy/v6 v6.0.0-alpha.1.0.20260519112248-0095b064a6c6 h1:AaQOU2NVLxnBGWkv5YSoxomcDCqlaqfCW0t00pNKtnk= github.com/go-git/go-billy/v6 v6.0.0-alpha.1.0.20260519112248-0095b064a6c6/go.mod h1:eaCUpHbedW7//EwcYmUDfJe2N6sJC9O12AT0OTqJR1E= github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1 h1:gmqi2jvsreu0s8JMLylYDFq4sbjHwwlhktMw0DUg3mA= github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1/go.mod h1:ECf1MqJlBdYpKggBrOXjo/0EnvRZx6D++I86UYjPgAQ= github.com/go-git/go-git/v6 v6.0.0-alpha.4.0.20260521151600-590487407c38 h1:uA2L2RZQTkmvHjzBqMNMFR+UWdjicJBc0UqhCrgodZs= github.com/go-git/go-git/v6 v6.0.0-alpha.4.0.20260521151600-590487407c38/go.mod h1:4ODa/G7hPWrh4Y+7lmt59Ij3zW38IEfvRoAZxLYYBhc= github.com/go-git/go-git/v6 v6.0.0-alpha.4.0.20260713100844-d5e9b9c7895b h1:RP3bg2PI8ZMeyGr31iJIqLTqLMEEXWGE2pSbAn/oRLk= github.com/go-git/go-git/v6 v6.0.0-alpha.4.0.20260713100844-d5e9b9c7895b/go.mod h1:6B0m9RQWmjdn10aHogqSpI7z7kwEUtELzzA8wW8gogg= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/kevinburke/ssh_config v1.6.0 h1:J1FBfmuVosPHf5GRdltRLhPJtJpTlMdKTBjRgTaQBFY= 23 unmodified lines

go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0=


Mgo.sum+8/-8

1 unmodified line

2 3 4 5 6 7 8 5 unmodified lines

14 15 16 17 18 19 20 21 22 23 24

1 unmodified line

import ( "context" "os" "testing"

"github.com/go-git/go-git/v6/plumbing" 5 unmodified lines

"entire.io/entire/git-sync/internal/syncertest" )

func TestMain(m *testing.M) { syncertest.IsolateGitConfig() os.Exit(m.Run()) }

func TestDefaultMaxMaterializedObjectsExported(t *testing.T) { // Verify the constant is exported and has a reasonable positive value. if DefaultMaxMaterializedObjects <= 0 {


Minternal/strategy/materialized/materialized_test.go+6

7 unmodified lines

8 9 10 11 12 13 14 10 unmodified lines

25 26 27 28 29 30 31 32 33 34 33 unmodified lines

3735 unmodified lines

}

var buf bytes.Buffer if err := transport.AdvertiseRefs(r.Context(), s.repo.Storer, &buf, service, false); err != nil { if err := transport.AdvertiseRefs(r.Context(), s.repo.Storer, &buf, service, false, protocol.V0); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } 509 unmodified lines

}

func TestMain(m *testing.M) { // Ensures empty config files for system/global so that test execution // is not affected by environmental settings (e.g. commit.gpgSign=true). if err := plugin.Register(plugin.ConfigLoader(), func() plugin.ConfigSource { return config.NewEmpty() }); err != nil { panic("register go-git empty config loader: " + err.Error()) }

m.Run() // Isolate tests from the host's system/global git config (e.g. // commit.gpgSign=true). This covers both go-git and the git binary the // SSH integration tests shell out to, which the go-git-only plugin // override did not. syncertest.IsolateGitConfig() os.Exit(m.Run()) }


Minternal/syncer/integration_test.go+9/-12

2 unmodified lines

3 4 5 6 7 8 9 7 unmodified lines

17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

2 unmodified lines

import ( "fmt" "io" "os" "strings" "testing" "time" 7 unmodified lines

"github.com/go-git/go-git/v6/storage/memory" )

// IsolateGitConfig makes the current process ignore the host's global and // system git configuration for the lifetime of the test binary, so developer // settings such as commit.gpgSign=true do not leak into tests. // // Both go-git (via its default NewAuto ConfigLoader plugin) and the git binary // honour GIT_CONFIG_GLOBAL and GIT_CONFIG_SYSTEM; pointing them at os.DevNull // yields empty global/system config. Call this from TestMain before m.Run(). // It uses os.Setenv rather than testing.T.Setenv because the suites run tests // in parallel, which forbids per-test Setenv. func IsolateGitConfig() { _ = os.Setenv("GIT_CONFIG_GLOBAL", os.DevNull) _ = os.Setenv("GIT_CONFIG_SYSTEM", os.DevNull) }

// SetRefAtBranch points an arbitrary ref (e.g. refs/notes/commits) at the // current tip of branch and returns the resolved hash. Used by --all-refs // integration tests to seed non-branch/non-tag refs.


Minternal/syncertest/repo.go+15