From dd97dc77bfff5da7a847c18aa2453acb153fef1e Mon Sep 17 00:00:00 2001 From: "go-git-renovate[bot]" <245267575+go-git-renovate[bot]@users.noreply.github.com> Date: Sat, 23 May 2026 07:29:36 +0000 Subject: [PATCH 1/2] build: Update module github.com/go-git/go-git/v6 to v6.0.0-alpha.4 Signed-off-by: go-git-renovate[bot] <245267575+go-git-renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c3043c6..7ffc547 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.25.10 require ( github.com/go-git/go-billy/v6 v6.0.0-alpha.1 github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1 - github.com/go-git/go-git/v6 v6.0.0-alpha.3.0.20260512141313-533ba09d9588 + github.com/go-git/go-git/v6 v6.0.0-alpha.4 github.com/spf13/cobra v1.10.2 golang.org/x/crypto v0.52.0 golang.org/x/term v0.43.0 diff --git a/go.sum b/go.sum index 4ea6d70..9795f1e 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/go-git/go-billy/v6 v6.0.0-alpha.1 h1:xVjAR4oUvrKy7/Xuw/lLlV3gkxR3KO2H github.com/go-git/go-billy/v6 v6.0.0-alpha.1/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.3.0.20260512141313-533ba09d9588 h1:TgVntrlBTW1A2HAoPljPLhP8rxmLzI4mUPv2Aq7r4KQ= -github.com/go-git/go-git/v6 v6.0.0-alpha.3.0.20260512141313-533ba09d9588/go.mod h1:4ODa/G7hPWrh4Y+7lmt59Ij3zW38IEfvRoAZxLYYBhc= +github.com/go-git/go-git/v6 v6.0.0-alpha.4 h1:aDTc2UGanmaE7FkGLSlBEB9nohMnQ+RKXcfq/D+esDQ= +github.com/go-git/go-git/v6 v6.0.0-alpha.4/go.mod h1:4ODa/G7hPWrh4Y+7lmt59Ij3zW38IEfvRoAZxLYYBhc= 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= From 0e358b3502fc7c93dab04fc4490f489f6edbe978 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 26 May 2026 12:22:50 +0000 Subject: [PATCH 2/2] fix(show-index): adapt stdin reader to idxfile decoder input API Agent-Logs-Url: https://github.com/go-git/cli/sessions/fdb5eddf-67f4-4606-869c-ae677df53b81 Co-authored-by: pjbgf <5452977+pjbgf@users.noreply.github.com> --- cmd/gogit/show-index.go | 42 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/cmd/gogit/show-index.go b/cmd/gogit/show-index.go index 1dd3524..d738d6b 100644 --- a/cmd/gogit/show-index.go +++ b/cmd/gogit/show-index.go @@ -1,10 +1,13 @@ package main import ( + "bytes" "crypto" "errors" "fmt" "io" + "io/fs" + "time" "github.com/go-git/go-git/v6/plumbing/format/idxfile" "github.com/go-git/go-git/v6/plumbing/hash" @@ -29,7 +32,12 @@ var showIndexCmd = &cobra.Command{ func showIndexRun(in io.Reader, out io.Writer) error { idx := idxfile.NewMemoryIndex(crypto.SHA1.Size()) - dec := idxfile.NewDecoder(in, hash.New(crypto.SHA1)) + idxIn, err := idxInput(in) + if err != nil { + return err + } + + dec := idxfile.NewDecoder(idxIn, hash.New(crypto.SHA1)) if err := dec.Decode(idx); err != nil { return fmt.Errorf("decode idx: %w", err) @@ -56,3 +64,35 @@ func showIndexRun(in io.Reader, out io.Writer) error { return nil } + +func idxInput(in io.Reader) (idxfile.Input, error) { + b, err := io.ReadAll(in) + if err != nil { + return nil, fmt.Errorf("read idx input: %w", err) + } + + return &memoryIdxInput{ + Reader: bytes.NewReader(b), + size: int64(len(b)), + }, nil +} + +type memoryIdxInput struct { + *bytes.Reader + size int64 +} + +func (in *memoryIdxInput) Stat() (fs.FileInfo, error) { + return memoryIdxFileInfo{size: in.size}, nil +} + +type memoryIdxFileInfo struct { + size int64 +} + +func (fi memoryIdxFileInfo) Name() string { return "" } +func (fi memoryIdxFileInfo) Size() int64 { return fi.size } +func (fi memoryIdxFileInfo) Mode() fs.FileMode { return 0 } +func (fi memoryIdxFileInfo) ModTime() time.Time { return time.Time{} } +func (fi memoryIdxFileInfo) IsDir() bool { return false } +func (fi memoryIdxFileInfo) Sys() any { return nil }