From 303cb6f9304bb3a1ea7982aae7c68ee1e6f6e092 Mon Sep 17 00:00:00 2001 From: DmitryFrolovTri <23313323+DmitryFrolovTri@users.noreply.github.com> Date: Thu, 22 Jan 2026 12:42:10 +0000 Subject: [PATCH] Replace WithStdin to WithStdinCopy in hook_pre_receive.go --- routers/private/hook_pre_receive.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/routers/private/hook_pre_receive.go b/routers/private/hook_pre_receive.go index 07c43aa5e7..76920f575b 100644 --- a/routers/private/hook_pre_receive.go +++ b/routers/private/hook_pre_receive.go @@ -405,11 +405,11 @@ func scanLFSPointersFromObjectIDs(ctx *gitea_context.PrivateContext, repoPath st 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)"). WithDir(repoPath). WithEnv(env). - WithStdin(bytes.NewReader(input.Bytes())) + WithStdinCopy(bytes.NewReader(input.Bytes())) checkBytes, _, err := checkCmd.RunStdBytes(ctx) if err != nil { @@ -449,7 +449,7 @@ func scanLFSPointersFromObjectIDs(ctx *gitea_context.PrivateContext, repoPath st catCmd := gitcmd.NewCommand("cat-file", "--batch"). WithDir(repoPath). WithEnv(env). - WithStdin(bytes.NewReader(input2.Bytes())) + WithStdinCopy(bytes.NewReader(input2.Bytes())) catBytes, _, err := catCmd.RunStdBytes(ctx) if err != nil {