Use local command properly

Prevent it from printing variable values
This commit is contained in:
JuneHyeon Bae 2015-06-07 16:39:44 +02:00
commit b142a4c378

View file

@ -1,5 +1,5 @@
# Query/use custom command for `git`. # Query/use custom command for `git`.
local git_cmd local git_cmd=
zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd
: ${git_cmd:=git} : ${git_cmd:=git}
@ -12,7 +12,7 @@ zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd
# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if # Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if
# it's not a symbolic ref, but in a Git repo. # it's not a symbolic ref, but in a Git repo.
function current_branch() { function current_branch() {
local ref local ref=
ref=$($git_cmd symbolic-ref --quiet HEAD 2> /dev/null) ref=$($git_cmd symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$? local ret=$?
if [[ $ret != 0 ]]; then if [[ $ret != 0 ]]; then