コード例 #1
0
ファイル: lookup.go プロジェクト: git-comment/git-comment
// Count comments on commit
// @return result.Result<uint16, error>
func CommentCountOnCommit(repo *git.Repository, commit string) result.Result {
	var count uint16 = 0
	return gg.CommitCommentRefIterator(repo, commit, func(ref *git.Reference) {
		count += 1
	}).FlatMap(func(value interface{}) result.Result {
		return result.NewSuccess(count)
	})
}
コード例 #2
0
ファイル: lookup.go プロジェクト: git-comment/git-comment
// Finds all comments on a commit
// @return result.Result<[]*Comment, error>
func commentsOnCommit(repo *git.Repository, commit *git.Commit) result.Result {
	var comments []interface{}
	return gg.CommitCommentRefIterator(repo, commit.Id().String(), func(ref *git.Reference) {
		CommentFromRef(repo, ref.Name()).FlatMap(func(comment interface{}) result.Result {
			comments = append(comments, comment)
			return result.Result{}
		})
	}).FlatMap(func(value interface{}) result.Result {
		return result.NewSuccess(comments)
	})
}