diff options
author | Victor Torres <vpaivatorres@gmail.com> | 2016-05-29 06:25:17 -0300 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2016-05-29 11:25:17 +0200 |
commit | c1951892314592295b0d5865f8ef5c72f360d6d0 (patch) | |
tree | f5d7ec035cddac5d5cc5b20ab4789c086bbb72ec /plugins/branch/branch.plugin.zsh | |
parent | 73cca9432253ab06c8ad64f96f21effac5532a6d (diff) | |
download | zsh-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.zsh | 7 |
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 :) |