From 75c008980749abc116188e5e537ec7884e97f61b260c18b3acf5422c4c2dc3dc Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Tue, 16 Jul 2024 07:14:12 +0200 Subject: [PATCH] . --- bots-common/git_utils.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bots-common/git_utils.go b/bots-common/git_utils.go index c8a92f1..0c111e2 100644 --- a/bots-common/git_utils.go +++ b/bots-common/git_utils.go @@ -217,26 +217,27 @@ func (c *ChanIO) Write(p []byte) (int, error) { } // read at least 1 byte, but don't block if nothing more in channel -func (c *ChanIO) Read(data []byte) (int, error) { +func (c *ChanIO) Read(data []byte) (idx int, err error) { var ok bool - var idx int data[idx], ok = <-c.ch if !ok { - return 0, io.EOF + err = io.EOF + return } idx++ for len(c.ch) > 0 && idx < len(data) { data[idx], ok = <- c.ch if !ok { - return idx, io.EOF + err = io.EOF + return } idx++ } - return idx, nil + return } type gitMsg struct { @@ -482,10 +483,6 @@ func (e *RequestHandler) GitSubmoduleCommitId(cwd, packageName, commitId string) cmd.Env = []string{ "GIT_CEILING_DIRECTORIES=" + e.GitPath, "GIT_CONFIG_GLOBAL=/dev/null", - "GIT_AUTHOR_NAME=" + e.GitCommiter, - "EMAIL=not@exist@src.opensuse.org", - "GIT_LFS_SKIP_SMUDGE=1", - "GIT_SSH_COMMAND=/usr/bin/ssh -o StrictHostKeyChecking=yes", } cmd.Dir = filepath.Join(e.GitPath, cwd) cmd.Stdout = &data_in @@ -494,7 +491,8 @@ func (e *RequestHandler) GitSubmoduleCommitId(cwd, packageName, commitId string) e.Logger.LogError("%s", data) return len(data), nil }) - e.Log("command run: %v", cmd.Run()) + e.Log("command run: %v", cmd.Args) + e.Error = cmd.Run() foundLock.Lock() return subCommitId, len(subCommitId) == len(commitId)