Support .git files with newline at the end

Fixes #876
This commit is contained in:
ZyX 2014-06-28 21:28:45 +04:00
parent 138611412e
commit abb4ed4efc
1 changed files with 2 additions and 0 deletions

View File

@ -33,6 +33,8 @@ def git_directory(directory):
if not raw.startswith(b'gitdir: '):
raise IOError('invalid gitfile format')
raw = raw[8:].decode(sys.getfilesystemencoding() or 'utf-8')
if raw[-1] == '\n':
raw = raw[:-1]
if not raw:
raise IOError('no path in gitfile')
return os.path.abspath(os.path.join(directory, raw))