summaryrefslogblamecommitdiff
path: root/nimgit/utils.nim
blob: f1fa5254ac327fc713025a25b817fe7401838146 (plain) (tree)
1
2
3
4
5
6
7
8
9
10



              





                                              


                                              




                                                                      
import times
import nimgit2
import types

proc getLastError* (): GitErrorObj = 
    let error = git_error_last()

    result.message = $error.message
    result.class   = error.klass.getErrorClass

proc parseGitTime* (time: git_time): GitTime =
    result.time     = fromUnix(time.time)
    result.offset   = time.offset

proc parseGitSignature* (signature: ptr git_signature): GitSignature =
    result.name  = $signature.name
    result.email = $signature.email
    result.when  = parseGitTime(signature.when)