aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/utils.go')
-rw-r--r--modules/git/utils.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/git/utils.go b/modules/git/utils.go
index 3c0c60f235..26eef23191 100644
--- a/modules/git/utils.go
+++ b/modules/git/utils.go
@@ -5,12 +5,33 @@
package git
import (
+ "bytes"
+ "container/list"
"path/filepath"
"strings"
)
const prettyLogFormat = `--pretty=format:%H`
+func parsePrettyFormatLog(repo *Repository, logByts []byte) (*list.List, error) {
+ l := list.New()
+ if len(logByts) == 0 {
+ return l, nil
+ }
+
+ parts := bytes.Split(logByts, []byte{'\n'})
+
+ for _, commitId := range parts {
+ commit, err := repo.GetCommit(string(commitId))
+ if err != nil {
+ return nil, err
+ }
+ l.PushBack(commit)
+ }
+
+ return l, nil
+}
+
func RefEndName(refStr string) string {
index := strings.LastIndex(refStr, "/")
if index != -1 {