From 388b185862c4b9a1b8cdfad4f6bdbd102a068d98 Mon Sep 17 00:00:00 2001 From: Victor Torres Date: Thu, 7 Apr 2016 18:02:37 -0300 Subject: [PATCH] After 'hg init' command, sometimes Mercurial do not create .hg/branch file so we'll take 'default' as fallback. --- plugins/branch/branch.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/branch/branch.plugin.zsh b/plugins/branch/branch.plugin.zsh index a1e9ca31b..2e5659bdf 100644 --- a/plugins/branch/branch.plugin.zsh +++ b/plugins/branch/branch.plugin.zsh @@ -17,7 +17,12 @@ function branch_prompt_info() { # Mercurial repository if [[ -d "${current_dir}/.hg" ]] then - echo '☿' $(<"$current_dir/.hg/branch") + if [[ -f "$current_dir/.hg/branch" ]] + then + echo '☿' $(<"$current_dir/.hg/branch") + else + echo '☿ default' + fi return; fi # Defines path as parent directory and keeps looking for :)