From e4d238691220f24328f35fad70e6218b4c917eb7 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 23 Aug 2021 15:24:34 +0100 Subject: [PATCH] ZSH: prompt: show branch on older versions of git --- shells/zsh/includes/promptconfig.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shells/zsh/includes/promptconfig.zsh b/shells/zsh/includes/promptconfig.zsh index 8ed5c73f..333ccbc9 100644 --- a/shells/zsh/includes/promptconfig.zsh +++ b/shells/zsh/includes/promptconfig.zsh @@ -121,7 +121,7 @@ function prompt_project() { prompt_git(){ local repoTopLevel="$(command git rev-parse --show-toplevel 2> /dev/null)" if [ -n "$repoTopLevel" ]; then - local branch="$(git branch --show-current 2> /dev/null)" + local branch="$(git branch --show-current 2> /dev/null || git rev-parse --abbrev-ref HEAD)" local tag="$(git describe --tags --exact-match HEAD 2> /dev/null)" local color="green" local ret=""