From c1951892314592295b0d5865f8ef5c72f360d6d0 Mon Sep 17 00:00:00 2001 From: Victor Torres Date: Sun, 29 May 2016 06:25:17 -0300 Subject: [PATCH] Use default branch on recently created Mercurial repository. (#4985) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After `hg init` command, sometimes Mercurial does not create `.hg/branch` file so we'll use 'default' as fallback, which is the master branch in Mercurial repositories. Signed-off-by: Marc Cornellà --- 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 a1e9ca31..2e5659bd 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 :)