mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
git plugin: global var for git command
due to issues like #3962 until a proper plugin-loading system is implemented
This commit is contained in:
parent
a570f4b7f3
commit
6c29041af7
1 changed files with 6 additions and 7 deletions
|
@ -1,7 +1,6 @@
|
||||||
# Query/use custom command for `git`.
|
# Query/use custom command for `git`.
|
||||||
local git_cmd
|
zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
|
||||||
zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd
|
: ${_omz_git_git_cmd:=git}
|
||||||
: ${git_cmd:=git}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Functions
|
# Functions
|
||||||
|
@ -13,20 +12,20 @@ zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd
|
||||||
# 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=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null)
|
||||||
local ret=$?
|
local ret=$?
|
||||||
if [[ $ret != 0 ]]; then
|
if [[ $ret != 0 ]]; then
|
||||||
[[ $ret == 128 ]] && return # no git repo.
|
[[ $ret == 128 ]] && return # no git repo.
|
||||||
ref=$($git_cmd rev-parse --short HEAD 2> /dev/null) || return
|
ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return
|
||||||
fi
|
fi
|
||||||
echo ${ref#refs/heads/}
|
echo ${ref#refs/heads/}
|
||||||
}
|
}
|
||||||
# The list of remotes
|
# The list of remotes
|
||||||
function current_repository() {
|
function current_repository() {
|
||||||
if ! $git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
|
if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo $($git_cmd remote -v | cut -d':' -f 2)
|
echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2)
|
||||||
}
|
}
|
||||||
# Pretty log messages
|
# Pretty log messages
|
||||||
function _git_log_prettily(){
|
function _git_log_prettily(){
|
||||||
|
|
Loading…
Reference in a new issue