27 lines
495 B
Go
27 lines
495 B
Go
package git
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
gitea_git "code.gitea.io/gitea/modules/git"
|
|
)
|
|
|
|
func parsePrettyFormatLogToList(repo *gitea_git.Repository, logs []byte) ([]*gitea_git.Commit, error) {
|
|
var commits []*gitea_git.Commit
|
|
if len(logs) == 0 {
|
|
return commits, nil
|
|
}
|
|
|
|
parts := bytes.Split(logs, []byte{'\n'})
|
|
|
|
for _, commitID := range parts {
|
|
commit, err := repo.GetCommit(string(commitID))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
commits = append(commits, commit)
|
|
}
|
|
|
|
return commits, nil
|
|
}
|