versioning: Expose .revision-hash as $ZSH_HIGHLIGHT_REVISION.
Currently, this only works in installed trees and exported tarballs; the parameter is left unset when running directly from a git worktree.
This commit is contained in:
parent
85500ec151
commit
0a7035170a
@ -32,6 +32,13 @@
|
|||||||
if [[ -o function_argzero ]]; then
|
if [[ -o function_argzero ]]; then
|
||||||
# $0 is reliable
|
# $0 is reliable
|
||||||
ZSH_HIGHLIGHT_VERSION=$(<"$0:h"/.version)
|
ZSH_HIGHLIGHT_VERSION=$(<"$0:h"/.version)
|
||||||
|
ZSH_HIGHLIGHT_REVISION=$(<"$0: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:
|
||||||
|
unset ZSH_HIGHLIGHT_REVISION
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# $0 is unreliable, so the call to _zsh_highlight_load_highlighters will fail.
|
# $0 is unreliable, so the call to _zsh_highlight_load_highlighters will fail.
|
||||||
# TODO: If 'zmodload zsh/parameter' is available, ${funcsourcetrace[1]%:*} might serve as a substitute?
|
# TODO: If 'zmodload zsh/parameter' is available, ${funcsourcetrace[1]%:*} might serve as a substitute?
|
||||||
|
Loading…
Reference in New Issue
Block a user