Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: vcs_info Mercurial backend branch name display



Greg Klanderman <gak <at> klanderman.net> writes:
> Looks like you have a spurious 'if' there..

<facepalm>

It took me ten minutes and an email from Bart (thanks Bart!) to see the mistake. 
Here's the fixed patch and now I'm gonna grab more coffee...

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg 
b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -58,10 +58,11 @@
 # If the user doesn't opt to invoke hg we can still get the current branch
 if [[ -z ${r_branch} && -r ${branchfile} ]] ; then
     r_branch=$(< ${branchfile})
-else
-    r_branch="default"
 fi
 
+# If we still don't know the branch it's safe to assume default
+[[ -n ${r_branch} ]] || r_branch="default"
+
 # The working dir has uncommitted-changes if the revision ends with a +
 if [[ $r_lrev[-1] == + ]] ; then
     hgchanges=1




Messages sorted by: Reverse Date, Date, Thread, Author