diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-07-26 02:28:04 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-07-26 02:28:04 -0400 |
commit | 5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635 (patch) | |
tree | 213666141efaf773c4411d41482387f1250068f8 /modules/git/utils.go | |
parent | 3f38ff6c09f0497980ad13fda9803907cee6d612 (diff) | |
download | gitea-5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635.tar.gz gitea-5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635.zip |
Huge updates!!!!! Be careful to merge!!!!
Diffstat (limited to 'modules/git/utils.go')
-rw-r--r-- | modules/git/utils.go | 21 |
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 { |