This commit is contained in:
Adam Majer 2024-07-16 07:14:12 +02:00
parent 4af0d31c69
commit 75c0089807

View File

@ -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 // 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 ok bool
var idx int
data[idx], ok = <-c.ch data[idx], ok = <-c.ch
if !ok { if !ok {
return 0, io.EOF err = io.EOF
return
} }
idx++ idx++
for len(c.ch) > 0 && idx < len(data) { for len(c.ch) > 0 && idx < len(data) {
data[idx], ok = <- c.ch data[idx], ok = <- c.ch
if !ok { if !ok {
return idx, io.EOF err = io.EOF
return
} }
idx++ idx++
} }
return idx, nil return
} }
type gitMsg struct { type gitMsg struct {
@ -482,10 +483,6 @@ func (e *RequestHandler) GitSubmoduleCommitId(cwd, packageName, commitId string)
cmd.Env = []string{ cmd.Env = []string{
"GIT_CEILING_DIRECTORIES=" + e.GitPath, "GIT_CEILING_DIRECTORIES=" + e.GitPath,
"GIT_CONFIG_GLOBAL=/dev/null", "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.Dir = filepath.Join(e.GitPath, cwd)
cmd.Stdout = &data_in cmd.Stdout = &data_in
@ -494,7 +491,8 @@ func (e *RequestHandler) GitSubmoduleCommitId(cwd, packageName, commitId string)
e.Logger.LogError("%s", data) e.Logger.LogError("%s", data)
return len(data), nil return len(data), nil
}) })
e.Log("command run: %v", cmd.Run()) e.Log("command run: %v", cmd.Args)
e.Error = cmd.Run()
foundLock.Lock() foundLock.Lock()
return subCommitId, len(subCommitId) == len(commitId) return subCommitId, len(subCommitId) == len(commitId)