Return absolute path for Git repo

This commit is contained in:
Corey Johnson
2013-03-01 11:40:27 -08:00
committed by probablycorey
parent 5e1701f8db
commit 595cf71d93
2 changed files with 6 additions and 6 deletions

View File

@@ -1,10 +1,10 @@
_ = require 'underscore'
fs = require 'fs'
Subscriber = require 'subscriber'
GitRepository = require 'git-repository'
module.exports =
class Git
@open: (path, options) ->
try
new Git(path, options)
@@ -37,7 +37,8 @@ class Git
refreshIndex: -> @getRepo().refreshIndex()
getPath: -> @getRepo().getPath()
getPath: ->
@path ?= fs.absolute(@getRepo().getPath())
destroy: ->
@getRepo().destroy()
@@ -45,8 +46,7 @@ class Git
@unsubscribe()
getWorkingDirectory: ->
repoPath = @getPath()
repoPath?.substring(0, repoPath.length - 6)
@getPath()?.replace(/\/\.git\/?/, '')
getHead: ->
@getRepo().getHead() ? ''