docket: better hash mismatch output

Could be useful to know both hashes when a mismatch happens.
This commit is contained in:
Fang 2021-09-26 12:49:27 +04:00
parent 38767e5dee
commit 2836fbde50
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972

View File

@ -125,11 +125,13 @@
::
[%glob @ @ ~]
=* base i.t.path
=* hash (slav %uv i.t.t.path)
=/ hash (slav %uv i.t.t.path)
=/ desk ~|(path/path (~(got by by-base) i.t.path))
=/ =charge ~|(desk/desk (~(got by charges) desk))
?> ?=(%glob -.chad.charge)
?> =(hash (hash-glob:cc glob.chad.charge))
=/ have (hash-glob:cc glob.chad.charge)
~| [%glob-unavailable requested=hash have=have]
?> =(hash have)
:_ state
:~ [%give %fact ~[path] %glob !>(`glob`glob.chad.charge)]
[%give %kick ~[path] ~]
@ -291,9 +293,15 @@
=/ =docket docket:(~(got by charges) desk)
?. ?=([%glob * %ames *] href.docket)
`state
?. =(hash.glob-reference.href.docket (hash-glob glob))
~& [dap.bowl %glob-hash-mismatch on=desk from=src.bowl]
`state
=* want hash.glob-reference.href.docket
=/ have (hash-glob glob)
?. =(want have)
%. `state
%- slog
:~ leaf+"docket: glob hash mismatch on {<desk>} from {<src.bowl>}"
leaf+"expected: {<want>}"
leaf+"received: {<have>}"
==
=. charges (new-chad:cha glob+glob)
=. by-base (~(put by by-base) base.href.docket desk)
[~[add-fact:cha] state]