mirror of
https://github.com/atom/atom.git
synced 2026-01-30 01:08:31 -05:00
17 lines
462 B
CoffeeScript
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
|