summaryrefslogtreecommitdiff
path: root/plugins/branch/branch.plugin.zsh
diff options
context:
space:
mode:
authorVictor Torres <vpaivatorres@gmail.com>2016-05-29 06:25:17 -0300
committerMarc Cornellà <marc.cornella@live.com>2016-05-29 11:25:17 +0200
commitc1951892314592295b0d5865f8ef5c72f360d6d0 (patch)
treef5d7ec035cddac5d5cc5b20ab4789c086bbb72ec /plugins/branch/branch.plugin.zsh
parent73cca9432253ab06c8ad64f96f21effac5532a6d (diff)
downloadzsh-c1951892314592295b0d5865f8ef5c72f360d6d0.tar.gz
zsh-c1951892314592295b0d5865f8ef5c72f360d6d0.tar.bz2
zsh-c1951892314592295b0d5865f8ef5c72f360d6d0.zip
Use default branch on recently created Mercurial repository. (#4985)
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à <marc.cornella@live.com>
Diffstat (limited to 'plugins/branch/branch.plugin.zsh')
-rw-r--r--plugins/branch/branch.plugin.zsh7
1 files changed, 6 insertions, 1 deletions
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 :)