lib/ghtorrent/ghtorrent.rb
def ensure_commit_comments(user, repo, sha)
      commit_id = db[:commits].first(:sha => sha)[:id]
      stored_comments = db[:commit_comments].filter(:commit_id => commit_id)
      commit_comments = retrieve_commit_comments(user, repo, sha)

      not_saved = commit_comments.reduce([]) do |acc, x|
        if stored_comments.find{|y| y[:comment_id] == x['id']}.nil?
          acc << x
        else
          acc
        end
      end

      not_saved.map{|x| save{ensure_commit_comment(user, repo, sha, x['id'])}}.select{|x| !x.nil?}
    end
def ensure_commit_comments(user, repo, sha)
      commit_id = db[:commits].first(:sha => sha)[:id]
      stored_comments = db[:commit_comments].filter(:commit_id => commit_id)
      commit_comments = retrieve_commit_comments(user, repo, sha)

      not_saved = commit_comments.reduce([]) do |acc, x|
        if stored_comments.find{|y| y[:comment_id] == x['id']}.nil?
          acc << x
        else
          acc
        end
      end

      not_saved.map{|x| save{ensure_commit_comment(user, repo, sha, x['id'])}}.select{|x| !x.nil?}
    end
Get all comments for a commit

 ==Parameters:
 [user]  The login name of the organization
 [user]  The repository containing the commit whose comments will be retrieved
 [sha]  The commit sha to retrieve comments for