Skip to content
Snippets Groups Projects
Commit 4114c20f authored by Ryan Gonzalez's avatar Ryan Gonzalez
Browse files

Preserve trailing newlines during rebase

Bash likes to remove these, which meant the metadata that went inside
the new commit didn't actually match the file it was read from.

apertis-issues#170



Signed-off-by: default avatarRyan Gonzalez <ryan.gonzalez@collabora.com>
parent ab5f0687
No related branches found
No related tags found
No related merge requests found
Pipeline #411525 failed
......@@ -79,7 +79,9 @@ for ref in $refs; do
message=$(ostree show "$prev" \\
| grep '^ ' \\
| sed 's/^ *//g')
metadata=$(ostree cat "$prev" metadata)
# Trick to preserve any trailing newlines:
# https://unix.stackexchange.com/a/383411/117660
IFS= read -rd '' metadata < <(ostree cat "$prev" metadata)
echo 'Applying new changes on top of remote...'
ostree commit -b "$ref" -m "$message" \\
......
......@@ -497,6 +497,10 @@ def test_subsummaries_flatpak_metadata(subsummaries):
for ref, (_commit_size, _commit_checksum, ref_metadata) in refs:
flatpak_metadata = ref_metadata['xa.data'][2]
# The metadata file should have a single trailing newline.
assert flatpak_metadata.endswith('\n')
assert not flatpak_metadata.endswith('\n\n')
keyfile = GLib.KeyFile.new()
keyfile.load_from_bytes(GLib.Bytes.new(flatpak_metadata.encode('ascii')), 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment