Skip to content

Commit 977201a

Browse files
authored
Merge pull request #62 from go-git/renovate/go-git
build: Update module github.com/go-git/go-git/v6 to v6.0.0-alpha.4
2 parents a5bba6f + c999e94 commit 977201a

4 files changed

Lines changed: 48 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Checkout
3232
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3333
- name: Setup Go
34-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
34+
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
3535
with:
3636
go-version: ${{ matrix.go-version }}
3737

@@ -51,7 +51,7 @@ jobs:
5151
- name: Checkout
5252
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5353
- name: Setup Go
54-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
54+
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
5555
with:
5656
go-version: stable
5757
- name: Run conformance

cmd/gogit/show-index.go

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package main
22

33
import (
4+
"bytes"
45
"crypto"
56
"errors"
67
"fmt"
78
"io"
9+
"io/fs"
10+
"time"
811

912
"github.com/go-git/go-git/v6/plumbing/format/idxfile"
1013
"github.com/go-git/go-git/v6/plumbing/hash"
@@ -29,7 +32,13 @@ var showIndexCmd = &cobra.Command{
2932

3033
func showIndexRun(in io.Reader, out io.Writer) error {
3134
idx := idxfile.NewMemoryIndex(crypto.SHA1.Size())
32-
dec := idxfile.NewDecoder(in, hash.New(crypto.SHA1))
35+
36+
idxIn, err := idxInput(in)
37+
if err != nil {
38+
return err
39+
}
40+
41+
dec := idxfile.NewDecoder(idxIn, hash.New(crypto.SHA1))
3342

3443
if err := dec.Decode(idx); err != nil {
3544
return fmt.Errorf("decode idx: %w", err)
@@ -56,3 +65,36 @@ func showIndexRun(in io.Reader, out io.Writer) error {
5665

5766
return nil
5867
}
68+
69+
func idxInput(in io.Reader) (idxfile.Input, error) {
70+
b, err := io.ReadAll(in)
71+
if err != nil {
72+
return nil, fmt.Errorf("read idx input: %w", err)
73+
}
74+
75+
return &memoryIdxInput{
76+
Reader: bytes.NewReader(b),
77+
size: int64(len(b)),
78+
}, nil
79+
}
80+
81+
type memoryIdxInput struct {
82+
*bytes.Reader
83+
84+
size int64
85+
}
86+
87+
func (in *memoryIdxInput) Stat() (fs.FileInfo, error) {
88+
return memoryIdxFileInfo{size: in.size}, nil
89+
}
90+
91+
type memoryIdxFileInfo struct {
92+
size int64
93+
}
94+
95+
func (fi memoryIdxFileInfo) Name() string { return "" }
96+
func (fi memoryIdxFileInfo) Size() int64 { return fi.size }
97+
func (fi memoryIdxFileInfo) Mode() fs.FileMode { return 0 }
98+
func (fi memoryIdxFileInfo) ModTime() time.Time { return time.Time{} }
99+
func (fi memoryIdxFileInfo) IsDir() bool { return false }
100+
func (fi memoryIdxFileInfo) Sys() any { return nil }

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolchain go1.25.10
77
require (
88
github.com/go-git/go-billy/v6 v6.0.0-alpha.1
99
github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1
10-
github.com/go-git/go-git/v6 v6.0.0-alpha.3.0.20260512141313-533ba09d9588
10+
github.com/go-git/go-git/v6 v6.0.0-alpha.4
1111
github.com/spf13/cobra v1.10.2
1212
golang.org/x/crypto v0.54.0
1313
golang.org/x/term v0.45.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ github.com/go-git/go-billy/v6 v6.0.0-alpha.1 h1:xVjAR4oUvrKy7/Xuw/lLlV3gkxR3KO2H
2222
github.com/go-git/go-billy/v6 v6.0.0-alpha.1/go.mod h1:eaCUpHbedW7//EwcYmUDfJe2N6sJC9O12AT0OTqJR1E=
2323
github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1 h1:gmqi2jvsreu0s8JMLylYDFq4sbjHwwlhktMw0DUg3mA=
2424
github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1/go.mod h1:ECf1MqJlBdYpKggBrOXjo/0EnvRZx6D++I86UYjPgAQ=
25-
github.com/go-git/go-git/v6 v6.0.0-alpha.3.0.20260512141313-533ba09d9588 h1:TgVntrlBTW1A2HAoPljPLhP8rxmLzI4mUPv2Aq7r4KQ=
26-
github.com/go-git/go-git/v6 v6.0.0-alpha.3.0.20260512141313-533ba09d9588/go.mod h1:4ODa/G7hPWrh4Y+7lmt59Ij3zW38IEfvRoAZxLYYBhc=
25+
github.com/go-git/go-git/v6 v6.0.0-alpha.4 h1:aDTc2UGanmaE7FkGLSlBEB9nohMnQ+RKXcfq/D+esDQ=
26+
github.com/go-git/go-git/v6 v6.0.0-alpha.4/go.mod h1:4ODa/G7hPWrh4Y+7lmt59Ij3zW38IEfvRoAZxLYYBhc=
2727
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
2828
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
2929
github.com/kevinburke/ssh_config v1.6.0 h1:J1FBfmuVosPHf5GRdltRLhPJtJpTlMdKTBjRgTaQBFY=

0 commit comments

Comments
 (0)