zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 1/2] vcs_info git: Flatten a nested if.
@ 2018-08-18 15:57 Daniel Shahaf
  2018-08-18 15:57 ` [PATCH 2/2] vcs_info git: For the branch name, try to find a symbolic name before falling back to a raw commit hex Daniel Shahaf
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Shahaf @ 2018-08-18 15:57 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-20 13:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-18 15:57 [PATCH 1/2] vcs_info git: Flatten a nested if Daniel Shahaf
2018-08-18 15:57 ` [PATCH 2/2] vcs_info git: For the branch name, try to find a symbolic name before falling back to a raw commit hex Daniel Shahaf
2018-08-18 20:41   ` Frank Terbeck
2018-08-19 12:32     ` Daniel Shahaf
2018-08-20 11:45       ` Frank Terbeck
2018-08-20 13:02         ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).