-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't add a trailing newline to metadata files.
By default, the base writeLines function adds a trailing newline to the end of the file, even when the input data did not contain any. While this is generally an acceptable behaviour, in the case of metadata files, we also hash the data and embed it in location files. Because the hashing happens over the in-memory data, it does not include the trailing newline. The hash of the on-disk file therefore ends up being different from the hash stored in the location file. It hasn't caused any practical issues because we trim leading and trailing whitespaces when reading the files back, getting the original serialized metadata that had been hashed. Similarly, when pushing a metadata file to a remote server, the client trims whitespaces from the metadata file. The behaviour is nevertheless confusing and it would be better to have consitent contents and hashes all around. The old behaviour of trimming whitespaces on read is preserved, as we must maintain compatibility with old files that do contain the newline.
- Loading branch information
Showing
6 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters