From 86522e18a7413da934f448bd1c56448576248c98 Mon Sep 17 00:00:00 2001 From: laerus Date: Wed, 14 Sep 2016 13:26:23 +0300 Subject: [PATCH] handle detached HEAD --- xonsh/prompt/vc_branch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xonsh/prompt/vc_branch.py b/xonsh/prompt/vc_branch.py index 5a53d507d..0a45e973b 100644 --- a/xonsh/prompt/vc_branch.py +++ b/xonsh/prompt/vc_branch.py @@ -20,7 +20,11 @@ def get_git_branch(): except (subprocess.CalledProcessError, subprocess.TimeoutExpired): return None else: - return status.split()[2].decode() + status = status.decode().split() + if status[2] == 'at': + return status[3] + else: + return status[2] def _get_parent_dir_for(path, dir_name, timeout): # walk up the directory tree to see if we are inside an hg repo