mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-12-04 21:56:45 +01:00
Skip installing .revision-hash if not running make install from a git checkout
Check --show-prefix rather than --is-inside-work-tree in case we're inside some other git repository (e.g. a ports tree).
This commit is contained in:
parent
415e762ab2
commit
2160c2d114
3 changed files with 14 additions and 11 deletions
|
|
@ -40,12 +40,14 @@ builtin unalias -m '[^+]*'
|
|||
if true; then
|
||||
# $0 is reliable
|
||||
typeset -g ZSH_HIGHLIGHT_VERSION=$(<"${0:A:h}"/.version)
|
||||
typeset -g ZSH_HIGHLIGHT_REVISION=$(<"${0:A:h}"/.revision-hash)
|
||||
if [[ $ZSH_HIGHLIGHT_REVISION == \$Format:* ]]; then
|
||||
# When running from a source tree without 'make install', $ZSH_HIGHLIGHT_REVISION
|
||||
# would be set to '$Format:%H$' literally. That's an invalid value, and obtaining
|
||||
# the valid value (via `git rev-parse HEAD`, as Makefile does) might be costly, so:
|
||||
ZSH_HIGHLIGHT_REVISION=HEAD
|
||||
if [[ -f "${0:A:h}"/.revision-hash ]]; then
|
||||
typeset -g ZSH_HIGHLIGHT_REVISION=$(<"${0:A:h}"/.revision-hash)
|
||||
if [[ $ZSH_HIGHLIGHT_REVISION == \$Format:* ]]; then
|
||||
# When running from a source tree without 'make install', $ZSH_HIGHLIGHT_REVISION
|
||||
# would be set to '$Format:%H$' literally. That's an invalid value, and obtaining
|
||||
# the valid value (via `git rev-parse HEAD`, as Makefile does) might be costly, so:
|
||||
ZSH_HIGHLIGHT_REVISION=HEAD
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue