mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
39786: vcs_info (hg): Use native hexdump implementation instead of external command.
Fixes issue whereby the external command would print "*" for repeated octets. Includes comment change, cf 39790.
This commit is contained in:
parent
88c42a2ba0
commit
74aa45910b
4 changed files with 28 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
2016-10-31 Daniel Shahaf <d.s@daniel.shahaf.name>
|
||||
|
||||
* 39786: Functions/VCS_Info/Backends/VCS_INFO_get_data_hg,
|
||||
Functions/VCS_Info/VCS_INFO_hexdump, Functions/VCS_Info/vcs_info:
|
||||
vcs_info (hg): Use native hexdump implementation instead of
|
||||
external command.
|
||||
|
||||
2016-10-30 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 39777: Src/parse.c, Test/D08cmdsubst.ztst: $() is a valid
|
||||
|
|
|
@ -40,9 +40,10 @@ VCS_INFO_adjust
|
|||
# Disabled by default anyway, so no harm done.
|
||||
if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
|
||||
if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" use-simple \
|
||||
&& ( VCS_INFO_check_com hexdump ) && [[ -r ${dirstatefile} ]] ; then
|
||||
# Calling hexdump is (much) faster than hg but doesn't get the local rev
|
||||
r_csetid=$(hexdump -n 20 -e '1/1 "%02x"' ${dirstatefile})
|
||||
&& VCS_INFO_hexdump ${dirstatefile} 20 ; then
|
||||
# Calling VCS_INFO_hexdump is (much) faster than hg but doesn't get
|
||||
# the local rev
|
||||
r_csetid=$REPLY
|
||||
else
|
||||
# Settling for a short (but unique!) hash because getting the full
|
||||
# 40-char hash in addition to all the other info we want isn't
|
||||
|
|
16
Functions/VCS_Info/VCS_INFO_hexdump
Normal file
16
Functions/VCS_Info/VCS_INFO_hexdump
Normal file
|
@ -0,0 +1,16 @@
|
|||
## vim:ft=zsh
|
||||
|
||||
# VCS_INFO_hexdump FILENAME BYTECOUNT
|
||||
#
|
||||
# Return in $REPLY a hexadecimal representation (lowercase, no whitespace)
|
||||
# of the first BYTECOUNT bytes of FILENAME.
|
||||
|
||||
if [[ -r $1 ]]; then
|
||||
setopt localoptions nomultibyte extendedglob
|
||||
local val
|
||||
read -k $2 -u 0 val <$1
|
||||
REPLY=${(Lj::)${(l:2::0:)${(@s//)val}//(#m)*/$(( [##16] ##$MATCH ))}}
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
|
@ -19,6 +19,7 @@ static_functions=(
|
|||
VCS_INFO_check_com
|
||||
VCS_INFO_formats
|
||||
VCS_INFO_get_cmd
|
||||
VCS_INFO_hexdump
|
||||
VCS_INFO_hook
|
||||
VCS_INFO_maxexports
|
||||
VCS_INFO_nvcsformats
|
||||
|
|
Loading…
Reference in a new issue