Skip to content

Commit

Permalink
Use default branch on recently created Mercurial repository. (#4985)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
victor-torres authored and mcornella committed May 29, 2016
1 parent 73cca94 commit c195189
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugins/branch/branch.plugin.zsh
Expand Up @@ -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 :)
Expand Down

0 comments on commit c195189

Please sign in to comment.