Save commit into db (wow it works)
parent
b2db4afe77
commit
6204444dbe
|
@ -115,9 +115,9 @@ func PushUpdate(opts PushUpdateOptions) (err error) {
|
|||
}
|
||||
|
||||
if isNewRef {
|
||||
l, err = newCommit.CommitsBeforeLimit(10)
|
||||
l, err = newCommit.CommitsBefore()
|
||||
if err != nil {
|
||||
return fmt.Errorf("CommitsBeforeLimit [commit_id: %s]: %v", newCommit.ID, err)
|
||||
return fmt.Errorf("CommitsBefore [commit_id: %s]: %v", newCommit.ID, err)
|
||||
}
|
||||
} else {
|
||||
l, err = newCommit.CommitsBeforeUntil(opts.OldCommitID)
|
||||
|
@ -125,6 +125,23 @@ func PushUpdate(opts PushUpdateOptions) (err error) {
|
|||
return fmt.Errorf("CommitsBeforeUntil [commit_id: %s]: %v", opts.OldCommitID, err)
|
||||
}
|
||||
}
|
||||
|
||||
searchCommits := make([]*Commit, 0)
|
||||
for e := l.Front(); e != nil; e = e.Next() {
|
||||
commit := e.Value.(*git.Commit)
|
||||
searchCommits = append(searchCommits, &Commit{
|
||||
RepoID: repo.ID,
|
||||
Sha: commit.ID.String(),
|
||||
Message: commit.Message(),
|
||||
AuthorEmail: commit.Author.Email,
|
||||
AuthorName: commit.Author.Name,
|
||||
AuthorTime: commit.Author.When,
|
||||
CommitterEmail: commit.Committer.Email,
|
||||
CommitterName: commit.Committer.Name,
|
||||
CommitterTime: commit.Committer.When,
|
||||
})
|
||||
}
|
||||
x.Insert(searchCommits)
|
||||
}
|
||||
|
||||
if err := CommitRepoAction(CommitRepoActionOptions{
|
||||
|
|
Loading…
Reference in New Issue