0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-16 19:07:41 +02:00

Replace WithStdin to WithStdinCopy in hook_pre_receive.go

This commit is contained in:
DmitryFrolovTri 2026-01-22 12:42:10 +00:00
parent fee277fc41
commit 303cb6f930

View File

@ -405,11 +405,11 @@ func scanLFSPointersFromObjectIDs(ctx *gitea_context.PrivateContext, repoPath st
input.WriteByte('\n') input.WriteByte('\n')
} }
// Feed stdin via WithStdin, RunStdBytes takes only context.Context in your version // Use batch-check to get object type and size for each object ID
checkCmd := gitcmd.NewCommand("cat-file", "--batch-check=%(objectname) %(objecttype) %(objectsize)"). checkCmd := gitcmd.NewCommand("cat-file", "--batch-check=%(objectname) %(objecttype) %(objectsize)").
WithDir(repoPath). WithDir(repoPath).
WithEnv(env). WithEnv(env).
WithStdin(bytes.NewReader(input.Bytes())) WithStdinCopy(bytes.NewReader(input.Bytes()))
checkBytes, _, err := checkCmd.RunStdBytes(ctx) checkBytes, _, err := checkCmd.RunStdBytes(ctx)
if err != nil { if err != nil {
@ -449,7 +449,7 @@ func scanLFSPointersFromObjectIDs(ctx *gitea_context.PrivateContext, repoPath st
catCmd := gitcmd.NewCommand("cat-file", "--batch"). catCmd := gitcmd.NewCommand("cat-file", "--batch").
WithDir(repoPath). WithDir(repoPath).
WithEnv(env). WithEnv(env).
WithStdin(bytes.NewReader(input2.Bytes())) WithStdinCopy(bytes.NewReader(input2.Bytes()))
catBytes, _, err := catCmd.RunStdBytes(ctx) catBytes, _, err := catCmd.RunStdBytes(ctx)
if err != nil { if err != nil {