lib/commit: Use more direct path for regfile commits
authorColin Walters <walters@verbum.org>
Fri, 8 Dec 2017 18:55:39 +0000 (13:55 -0500)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 12 Dec 2017 14:17:20 +0000 (14:17 +0000)
commitf81e3c6f03f6636f1e4e4d1f13a79983820a9d29
tree453c85d0e8312e381df78939710cfc6a0aeeeeed
parent6d8aaf629c904d6b0e1c2a06641829590eeebf45
lib/commit: Use more direct path for regfile commits

In the non-`CONSUME` path for regfiles (which happens currently for
`bare-user`), we go to a lot of contortions to make an "object stream",
only to immediately parse it again.

Fixing this will also enable the `G_IS_FILE_DESCRIPTOR_BASED()` fast path in
commit, since the input stream will actually reference the file descriptor and
not be an `_OstreeChainInputStream`.

There's a slight concern here in that we're no longer checksumming *literally*
the object stream passed in for the stream case, but I mention in the comment,
the data should be the same, and if it's not somehow we're not adding risk,
since the checksum is still covering the data we actually care about.

Prep for further changes to break up the `write_content_object()` path into
separate paths for archive, as well as regfile vs symlink in non-archive.

Closes: #1371
Approved by: jlebon
src/libostree/ostree-repo-commit.c
src/libotutil/ot-checksum-instream.c
src/libotutil/ot-checksum-instream.h