mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
upgrade wakatime-cli to master version to fix unhandled retry exception
This commit is contained in:
@ -38,11 +38,11 @@ class Git(BaseProject):
|
||||
head = os.path.join(self._project_base(), '.git', 'HEAD')
|
||||
try:
|
||||
with open(head, 'r', encoding='utf-8') as fh:
|
||||
return u(fh.readline().strip().rsplit('/', 1)[-1])
|
||||
return self._get_branch_from_head_file(fh.readline())
|
||||
except UnicodeDecodeError: # pragma: nocover
|
||||
try:
|
||||
with open(head, 'r', encoding=sys.getfilesystemencoding()) as fh:
|
||||
return u(fh.readline().strip().rsplit('/', 1)[-1])
|
||||
return self._get_branch_from_head_file(fh.readline())
|
||||
except:
|
||||
log.traceback('warn')
|
||||
except IOError: # pragma: nocover
|
||||
@ -64,3 +64,8 @@ class Git(BaseProject):
|
||||
if split_path[1] == '':
|
||||
return None
|
||||
return self._find_git_config_file(split_path[0])
|
||||
|
||||
def _get_branch_from_head_file(self, line):
|
||||
if u(line.strip()).startswith('ref: '):
|
||||
return u(line.strip().rsplit('/', 1)[-1])
|
||||
return None
|
||||
|
Reference in New Issue
Block a user