Skip to content

Commit e32fbf1

Browse files
committed
Merge branch 'hotfix/2.31.2'
2 parents 66530b7 + 5f60b26 commit e32fbf1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

backslash/contrib/slash_plugin.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,11 @@ def _update_scm_info(self, test_info):
342342
test_info['scm_revision'] = hexsha
343343
test_info['scm_dirty'] = bool(repo.untracked_files or repo.index.diff(None) or repo.index.diff(repo.head.commit))
344344
if self.client.api.info().endpoints.report_test_start.version >= 3:
345-
test_info['scm_local_branch'] = repo.active_branch.name
346-
tracking_branch = repo.active_branch.tracking_branch()
347-
if tracking_branch is not None:
348-
test_info['scm_remote_branch'] = tracking_branch.name
345+
if not repo.head.is_detached:
346+
test_info['scm_local_branch'] = repo.active_branch.name
347+
tracking_branch = repo.active_branch.tracking_branch()
348+
if tracking_branch is not None:
349+
test_info['scm_remote_branch'] = tracking_branch.name
349350
except Exception: # pylint: disable=broad-except
350351
_logger.warning('Error when obtaining SCM information', exc_info=True)
351352

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Changelog
22
=========
33

4+
* :release:`2.31.2 <14-9-2017>`
5+
* :bug:`54` Handle cases of detached head correctly when deducing local branch
46
* :release:`2.31.1 <11-9-2017>`
57
* :bug:`53` Use api session when constructing lazy queries
68
* :release:`2.31.0 <10-9-2017>`

0 commit comments

Comments
 (0)