Files
atom/src/app/git.coffee
2012-11-02 15:33:07 -07:00

17 lines
462 B
CoffeeScript

module.exports =
class Git
constructor: (@repoPath) ->
@repo = new GitRepository(@repoPath)
getHead: ->
@repo.getHead() || ''
getShortHead: ->
head = @getHead()
return head.substring(11) if head.indexOf('refs/heads/') is 0
return head.substring(10) if head.indexOf('refs/tags/') is 0
return head.substring(13) if head.indexOf('refs/remotes/') is 0
return head.substring(0, 7) if head.match(/[a-fA-F0-9]{40}/)
return head