From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH 1/2] vcs_info git: Flatten a nested if.
Date: Sat, 18 Aug 2018 15:57:18 +0000 [thread overview]
Message-ID: <20180818155719.23574-1-danielsh@tarpaulin.shahaf.local2> (raw)
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
next reply other threads:[~2018-08-18 15:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-18 15:57 Daniel Shahaf [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180818155719.23574-1-danielsh@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).