-
Notifications
You must be signed in to change notification settings - Fork 305
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
Commit regfile prep #1257
Commit regfile prep #1257
Conversation
☔ The latest upstream changes (presumably 1c9975c) made this pull request unmergeable. Please resolve the merge conflicts. |
77ff186
to
b09e388
Compare
Rebased 🏄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just a few very minor things!
src/libostree/ostree-core.c
Outdated
* @xattrs: (allow-none): Optional extended attribute array | ||
* | ||
* Returns: (transfer full): A new #GVariant containing file header for an archive repository | ||
/* Like _ostree_file_header_new(), but used for the comprssed format in archive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: compressed
src/libostree/ostree-core.c
Outdated
const guchar padding_nuls[8] = {0, 0, 0, 0, 0, 0, 0, 0}; | ||
guint bits; | ||
if (alignment == 8) | ||
bits = alignment_offset & 7; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not new to this patch, though can we add a comment explaining these? This is essentially a more efficient way to do modulo 8 and 4, right?
src/libostree/ostree-core.c
Outdated
return FALSE; | ||
ret_bytes_written += bytes_written; | ||
g_string_append_len (buf, (char*)&variant_size_u32_be, sizeof (variant_size_u32_be)); | ||
const gsize alignment_offset = sizeof(variant_size_u32_be); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: sizeof
spacing.
Nothing was using the `bytes_written` data (we always discard partially written tmpfiles), so simplify everything by dropping it. Further, we always passed an offset of `0`, so drop that argument too. (I believe that this was previously used by the "pack files" code that we deleted long ago) Second, we had an unnecessary internal wrapper for this function; drop that too.
No functional changes, just prep for more work.
This simplifies a lot of code; the header function was structured to write to an input stream, but many callers only wanted the checksum, so it's simpler (and error-free) to simply allocate a whole buffer and checksum that. For the callers that want to write it, it's also still simpler to allocate the buffer and write the whole thing rather than having this function do the writing. A lot of the complexity here again is a legacy of the packfile code, which is dead. This is prep for faster regfile commits where we can avoid `G{In,Out}putStream`.
It's no longer called directly by the pull code, so make it static. The goal here is to have the pull and local-fs commit paths use higher level more efficient APIs, and eventually make those APIs public.
b09e388
to
d2c654f
Compare
Rebased 🏄 and fixups ⬆️ |
⚡ Test exempted: pull fully rebased and already tested. |
No functional changes, just prep for more work. Closes: #1257 Approved by: jlebon
This simplifies a lot of code; the header function was structured to write to an input stream, but many callers only wanted the checksum, so it's simpler (and error-free) to simply allocate a whole buffer and checksum that. For the callers that want to write it, it's also still simpler to allocate the buffer and write the whole thing rather than having this function do the writing. A lot of the complexity here again is a legacy of the packfile code, which is dead. This is prep for faster regfile commits where we can avoid `G{In,Out}putStream`. Closes: #1257 Approved by: jlebon
It's no longer called directly by the pull code, so make it static. The goal here is to have the pull and local-fs commit paths use higher level more efficient APIs, and eventually make those APIs public. Closes: #1257 Approved by: jlebon
Depends: #1256