zsh-workers
 help / color / mirror / code / Atom feed
From: Reed Riley <john.reed.riley@gmail.com>
To: zsh-workers@zsh.org
Cc: Reed Riley <john.reed.riley@gmail.com>
Subject: [PATCH] Fix hexdump command used for mercurial dirstate parsing
Date: Sat, 29 Oct 2016 22:47:23 -0400	[thread overview]
Message-ID: <20161030024723.62832-1-john.reed.riley@gmail.com> (raw)

Normally, the old command works.  But very rarely, it outputs a string
like the following instead:
❯ hexdump -n20 -e '1/1 "%02x"' .hg/dirstate
77bba665e970146bd2be0b2da40092e340*
8804

Changing the command resolves the problem:
❯ xxd -p -l20 .hg/dirstate
77bba665e970146bd2be0b2da40092e340408804
---
 Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index f35ad59..abcd8bc 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -42,7 +42,7 @@ 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})
+        r_csetid=$(xxd -p -l20 ${dirstatefile})
     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
-- 
2.10.2


             reply	other threads:[~2016-10-30  2:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-30  2:47 Reed Riley [this message]
2016-10-30  5:34 ` Bart Schaefer
2016-10-30  7:01 ` Mikael Magnusson
2016-10-30 11:11 ` Frank Terbeck
2016-10-30 14:43   ` Reed Riley
2016-10-30 16:58     ` Reed Riley
2016-10-30 19:57       ` Frank Terbeck
2016-10-30 15:55   ` Daniel Shahaf
2016-10-30 17:06     ` Daniel Shahaf
2016-10-30 18:28       ` Bart Schaefer
2016-10-30 20:33         ` Daniel Shahaf
2016-10-31  9:04           ` Frank Terbeck
2016-10-31 18:37             ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161030024723.62832-1-john.reed.riley@gmail.com \
    --to=john.reed.riley@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).