abcxyz / abc

Apache License 2.0
12 stars 3 forks source link

Upgrade() bails out if dirhash check shows upgrade isn't needed #471

Closed drevell closed 7 months ago

drevell commented 7 months ago

With this change, we abort the upgrade operation with a success+noop if the template version that we're considering upgrading to is already the version that's installed. This supports some convenient user journeys like "just blindly try to upgrade all the templates in case one of them happens to need it."

To do this, we had to take the template downloading logic out of the Render function, because we only want to call Render in the case where an upgrade is actually needed. So now the Upgrade() function does its own downloading, and calls a new function RenderAlreadyDownloaded().

We also add a wrapper around the upstream dirhash library to handle versioning of hashes (like the "h1" in h1:abcdabcd).