aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/cli/commands/cli_env.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py
index 5228c3e8..9423631b 100644
--- a/functest/cli/commands/cli_env.py
+++ b/functest/cli/commands/cli_env.py
@@ -48,10 +48,14 @@ class CliEnv:
installer_info = ("%s, %s" % (install_type, installer_ip))
scenario = _get_value(CONST.DEPLOY_SCENARIO)
node = _get_value(CONST.NODE_NAME)
- repo = git.Repo(CONST.dir_repo_functest)
- branch = repo.head.reference
- git_branch = branch.name
- git_hash = branch.commit.hexsha
+ repo_h = git.Repo(CONST.dir_repo_functest).head
+ if repo_h.is_detached:
+ git_branch = 'detached from FETCH_HEAD'
+ git_hash = repo_h.commit.hexsha
+ else:
+ branch = repo_h.reference
+ git_branch = branch.name
+ git_hash = branch.commit.hexsha
is_debug = _get_value(CONST.CI_DEBUG, 'false')
build_tag = CONST.BUILD_TAG
if build_tag is not None: