|
|
@ -5,12 +5,36 @@
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Gets the path to the Git directory.
|
|
|
|
|
|
|
|
function _git-dir() {
|
|
|
|
|
|
|
|
local git_root="$(git-root)"
|
|
|
|
|
|
|
|
local git_dir_or_file="${git_root}/.git"
|
|
|
|
|
|
|
|
local git_dir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ ! -d "$git_root" ]]; then
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -f "$git_dir_or_file" ]]; then
|
|
|
|
|
|
|
|
git_dir="${${${$(<"$git_dir_or_file")}[(fr)gitdir:*]}#gitdir: }"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
git_dir="$git_dir_or_file"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -d "$git_dir" ]]; then
|
|
|
|
|
|
|
|
print "$git_dir"
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Gets the Git special action (am, merge, rebase, etc.).
|
|
|
|
# Gets the Git special action (am, merge, rebase, etc.).
|
|
|
|
# Borrowed from vcs_info and edited.
|
|
|
|
# Borrowed from vcs_info and edited.
|
|
|
|
function _git-action() {
|
|
|
|
function _git-action() {
|
|
|
|
local action=''
|
|
|
|
local action=''
|
|
|
|
local action_dir
|
|
|
|
local action_dir
|
|
|
|
local git_dir="$(git-root)/.git"
|
|
|
|
local git_dir="$(_git-dir)"
|
|
|
|
|
|
|
|
|
|
|
|
for action_dir in \
|
|
|
|
for action_dir in \
|
|
|
|
"${git_dir}/rebase-apply" \
|
|
|
|
"${git_dir}/rebase-apply" \
|
|
|
@ -200,7 +224,7 @@ function git-info() {
|
|
|
|
zformat -f commit_formatted "$commit_format" "c:$commit_short"
|
|
|
|
zformat -f commit_formatted "$commit_format" "c:$commit_short"
|
|
|
|
|
|
|
|
|
|
|
|
# Stashed
|
|
|
|
# Stashed
|
|
|
|
if [[ -f "$(git-root)/.git/refs/stash" ]]; then
|
|
|
|
if [[ -f "$(_git-dir)/refs/stash" ]]; then
|
|
|
|
stashed="$(git stash list 2>/dev/null | wc -l)"
|
|
|
|
stashed="$(git stash list 2>/dev/null | wc -l)"
|
|
|
|
zstyle -s ':omz:plugin:git:prompt' stashed 'stashed_format'
|
|
|
|
zstyle -s ':omz:plugin:git:prompt' stashed 'stashed_format'
|
|
|
|
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
|
|
|
|
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
|
|
|
|