Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
6c29041a
Commit
6c29041a
authored
Jun 11, 2015
by
ncanceill
Browse files
git plugin: global var for git command
due to issues like #3962 until a proper plugin-loading system is implemented
parent
a570f4b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/git/git.plugin.zsh
View file @
6c29041a
# Query/use custom command for `git`.
local
git_cmd
zstyle
-s
":vcs_info:git:*:-all-"
"command"
git_cmd
:
${
git_cmd
:
=git
}
zstyle
-s
":vcs_info:git:*:-all-"
"command"
_omz_git_git_cmd
:
${
_omz_git_git_cmd
:
=git
}
#
# 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.
function
current_branch
()
{
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
=
$?
if
[[
$ret
!=
0
]]
;
then
[[
$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
echo
${
ref
#refs/heads/
}
}
# The list of remotes
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
fi
echo
$(
$git_cmd
remote
-v
|
cut
-d
':'
-f
2
)
echo
$(
$
_omz_git_
git_cmd
remote
-v
|
cut
-d
':'
-f
2
)
}
# Pretty log messages
function
_git_log_prettily
(){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment