branchmap-v3: detect invalid headerline and raise error
Otherwise, broken cache file would be accept as valid, but empty.
--- a/mercurial/branchmap.py Fri Sep 27 00:55:54 2024 +0200
+++ b/mercurial/branchmap.py Fri Sep 27 02:27:54 2024 +0200
@@ -937,6 +937,10 @@
def _load_header(cls, repo, lineiter):
header_line = next(lineiter)
pieces = header_line.rstrip(b'\n').split(b" ")
+ for p in pieces:
+ if b'=' not in p:
+ msg = b"invalid header_line: %r" % header_line
+ raise ValueError(msg)
cache_keys = dict(p.split(b'=', 1) for p in pieces)
args = {}