This commit is contained in:
2024-07-11 16:45:49 +02:00
parent 429cc2fe02
commit f40888ea45
3 changed files with 55 additions and 14 deletions

View File

@@ -202,3 +202,24 @@ func (e *RequestHandler) GitExec(cwd string, params ...string) ExecStream {
return e
}
type writerFunc func([]byte) (int, error)
// Implement the Write method for the custom type
func (f writerFunc) Write(p []byte) (int, error) {
return f(p)
}
func (e *RequestHandler) GitSubmoduleCommitId(cwd, packageName string) (string, bool) {
if e.Error != nil {
return "", false
}
cmd := exec.Command("/usr/bin/git", "cat-file", "--batch")
cmd.Dir = filepath.Join(e.GitPath, cwd)
cmd.Stdout = writerFunc(func(p []byte) (int, error) {
return len(p), nil
})
return "", false
}