We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31cb438 commit d4ccd4dCopy full SHA for d4ccd4d
libvcs/git.py
@@ -466,14 +466,16 @@ def get_git_version(self):
466
def get_current_remote_name(self):
467
"""Retrieve name of the remote / upstream of currently checked out branch.
468
469
- :rtype: str
+ :rtype: str, None if no remote set
470
"""
471
current_status = self.run(['status', '-sb'])
472
# git status -sb
473
# ## v1.0-ourbranch...remotename/v1.0-ourbranch
474
match = re.match(
475
r'^## (?P<branch>.*)\.{3}(?P<remote_slash_branch>.*)', current_status,
476
)
477
+ if match is None: # No upstream set
478
+ return None
479
return match.group('remote_slash_branch').replace(
480
'/' + match.group('branch'), ''
481
0 commit comments