mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-10-01 15:36:05 +02:00
Compare commits
2
Commits
a8da200b18
...
97dfe1ae54
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97dfe1ae54 | ||
|
|
c6d78edc8f |
+24
-15
@@ -136,25 +136,34 @@ _omz_git_head() {
|
|||||||
[[ -r "$gitdir/HEAD" ]] || return 1
|
[[ -r "$gitdir/HEAD" ]] || return 1
|
||||||
read -r head 2>/dev/null < "$gitdir/HEAD" || return 1
|
read -r head 2>/dev/null < "$gitdir/HEAD" || return 1
|
||||||
|
|
||||||
# detached HEAD: the file holds the commit itself
|
if [[ "$head" = ref:\ * ]]; then
|
||||||
[[ "$head" = ref:\ * ]] || { REPLY="$head"; return 0 }
|
ref="${head#ref: }"
|
||||||
|
if [[ -r "$common/$ref" ]]; then
|
||||||
ref="${head#ref: }"
|
read -r REPLY 2>/dev/null < "$common/$ref" || return 1
|
||||||
if [[ -r "$common/$ref" ]]; then
|
elif [[ -r "$common/packed-refs" ]]; then
|
||||||
read -r REPLY 2>/dev/null < "$common/$ref" || return 1
|
lines=("${(@f)$(<"$common/packed-refs")}")
|
||||||
[[ "$REPLY" != ref:\ * ]] || return 1
|
REPLY="${lines[(r)* ${(b)ref}]%% *}"
|
||||||
return 0
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# detached HEAD: the file holds the commit itself
|
||||||
|
REPLY="$head"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -r "$common/packed-refs" ]] || return 1
|
# only an object ID is a usable answer: a symbolic ref, a malformed file or
|
||||||
lines=("${(@f)$(<"$common/packed-refs")}")
|
# a missed packed entry all fall through to the git fallback instead
|
||||||
REPLY="${lines[(r)* ${(b)ref}]%% *}"
|
[[ -n "$REPLY" && -z "${REPLY//[0-9a-f]/}" ]] \
|
||||||
[[ -n "$REPLY" ]]
|
&& (( ${#REPLY} == 40 || ${#REPLY} == 64 ))
|
||||||
}
|
}
|
||||||
|
|
||||||
# Construct zcompdump OMZ metadata
|
# Construct zcompdump OMZ metadata. The helper reports through $REPLY, so
|
||||||
_omz_git_head || REPLY="$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
|
# call it in a scope that keeps that out of the global namespace.
|
||||||
zcompdump_revision="#omz revision: $REPLY"
|
() {
|
||||||
|
local REPLY
|
||||||
|
_omz_git_head || REPLY="$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
|
||||||
|
typeset -g zcompdump_revision="#omz revision: $REPLY"
|
||||||
|
}
|
||||||
zcompdump_fpath="#omz fpath: $fpath"
|
zcompdump_fpath="#omz fpath: $fpath"
|
||||||
unset -f _omz_git_head
|
unset -f _omz_git_head
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user