-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add version information to "bat cache" files to prevent incompatibilities #882
Comments
A couple of small considerations:
My thoughts on the second consideration: I don't think deleting it automatically would the correct course of action. If users update bat and find their theme or syntax mappings missing without any explanation, they might consider it a bug. Ruling that out would leave us with two options: Warn the user and proceed anyways; or print an error and exit. Personally, I prefer printing a stern warning and continuing. Let the user proceed at their own risk knowing the potential consequences. |
Yes. We would assume that these are artifacts from a version of
A third option might be to regenerate the files from the config folder "on the fly". Now this would of course only work if (1) the orignal path with themes and syntaxes still exists in unmodified form and (2) if we know that path. I think both points could be solved by storing additional information in the metadata file. It might be as simple as storing a file path and a hash (across all files in the version: "7.4.0"
source:
path: /home/shark/.config/bat
hash: "9333753eab96a4daca9a1f69bb8a15ef" |
When saving/reading user-provided syntaxes or themes, `bat` will now maintain a `metadata.yaml` file which includes information about the `bat` version which was used to create the cached files. When loading cached files, we now print an error if they have been created with an incompatible version closes #882
When saving/reading user-provided syntaxes or themes, `bat` will now maintain a `metadata.yaml` file which includes information about the `bat` version which was used to create the cached files. When loading cached files, we now print an error if they have been created with an incompatible version closes #882
When saving/reading user-provided syntaxes or themes, `bat` will now maintain a `metadata.yaml` file which includes information about the `bat` version which was used to create the cached files. When loading cached files, we now print an error if they have been created with an incompatible version closes #882
There are numerous reports of bugs that emerged from cached assets that were generated with an older version of
bat
(#425, #853, #797, maybe #704). Even if no bugs appear, new syntaxes/themes appear to be missing because the old assets have not been re-generated.One way to prevent this would be to store version information with the cached assets. This way, we could check for compatibility upon loading.
The version information should probably be stored in a separate text file with a very simple format which is unlikely to change in the future. Maybe just a simple
assets.yaml
file with:The text was updated successfully, but these errors were encountered: