.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user