mirror of
https://github.com/arzzen/git-quick-stats.git
synced 2026-09-10 07:36:19 -04:00
Optimize branch existence validator
This commit is contained in:
parent
e9f085f20e
commit
c7d456465e
|
|
@ -172,18 +172,15 @@ function detailedGitStats() {
|
|||
local _branch=""
|
||||
|
||||
# Check if requesting for a specific branch
|
||||
if [ -n "${branch}" ]; then
|
||||
if [[ -n "${branch}" ]]; then
|
||||
# Check if branch exist
|
||||
{
|
||||
does_exist=`git show-ref refs/heads/${branch}`
|
||||
if [ -n "$does_exist" ]; then
|
||||
is_branch_existing=true
|
||||
_branch=${branch}
|
||||
fi
|
||||
} || {
|
||||
if git show-ref refs/heads/"${branch}"; then
|
||||
is_branch_existing=true
|
||||
_branch="${branch}"
|
||||
else
|
||||
is_branch_existing=false
|
||||
_branch=""
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Prompt message
|
||||
|
|
|
|||
Loading…
Reference in a new issue