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

[PATCH 1/2] vcs_info git: Flatten a nested if.



No functional change.
---
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index f3dd95dcb..a44a62c79 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -104,16 +104,11 @@ VCS_INFO_git_getbranch () {
     elif [[ -d "${gitdir}/.dotest-merge" ]] ; then
         gitbranch="$(< ${gitdir}/.dotest-merge/head-name)"
 
+    elif gitbranch="$(${(z)gitsymref} 2> /dev/null)" ; then
+    elif gitbranch="refs/tags/$(${vcs_comm[cmd]} describe --all --exact-match HEAD 2>/dev/null)" ; then
+    elif gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..." ; then
     else
-        gitbranch="$(${(z)gitsymref} 2> /dev/null)"
-
-        if [[ $? -ne 0 ]] ; then
-            gitbranch="refs/tags/$(${vcs_comm[cmd]} describe --all --exact-match HEAD 2>/dev/null)"
-
-            if [[ $? -ne 0 ]] ; then
-                gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..."
-            fi
-        fi
+        # Can't happen
     fi
 
     return 0



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