Mercurial > hg
changeset 44704:0415a566742a
manifest: fix another pure-parsing 20-byte assumption
Differential Revision: https://phab.mercurial-scm.org/D8370
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 02 Apr 2020 15:57:07 -0400 |
parents | 0e99b876966a |
children | 75f1197db884 |
files | mercurial/manifest.py |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/manifest.py Thu Apr 02 15:52:10 2020 -0400 +++ b/mercurial/manifest.py Thu Apr 02 15:57:07 2020 -0400 @@ -377,8 +377,13 @@ t = self.extradata[-cur - 1] l.append(self._pack(t)) self.positions[i] = offset - if len(t[1]) > 20: - self.extrainfo[i] = ord(t[1][21]) + # Hashes are either 20 bytes (old sha1s) or 32 + # bytes (new non-sha1). + hlen = 20 + if len(t[1]) > 25: + hlen = 32 + if len(t[1]) > hlen: + self.extrainfo[i] = ord(t[1][hlen + 1]) offset += len(l[-1]) i += 1 self.data = b''.join(l)