summaryrefslogtreecommitdiff
path: root/src/ostree/ot-dump.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2018-02-08 16:33:18 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-02-12 19:03:18 +0000
commit0041a7a1ed8173a6497429520ed06e981703625c (patch)
tree65343912a72d807468c0c6fe20d7a2d6cba1093c /src/ostree/ot-dump.c
parent5848de93a4346ad3c49d907ced7612578781f5e8 (diff)
downloadostree-0041a7a1ed8173a6497429520ed06e981703625c.tar.gz
core: Add API (and standard concept for) content checksum
There are a few cases for knowing whether a commit has identical content to another commit. Some people want to do a "promotion workflow", where the content of a commit on a tesitng branch is then "promoted" to a production branch with `ostree commit --tree=ref`. Another use case I just hit in rpm-ostree deals with [jigdo](https://github.com/projectatomic/rpm-ostree/issues/1081) where we're importing RPMs on both the client and server, and will be using the content checksum, since the client/server cases inject different metadata into the commit object. Closes: https://github.com/ostreedev/ostree/issues/1315 Closes: #1449 Approved by: jlebon
Diffstat (limited to 'src/ostree/ot-dump.c')
-rw-r--r--src/ostree/ot-dump.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ostree/ot-dump.c b/src/ostree/ot-dump.c
index 6ef7bbf7..1ef63740 100644
--- a/src/ostree/ot-dump.c
+++ b/src/ostree/ot-dump.c
@@ -126,6 +126,8 @@ dump_commit (GVariant *variant,
str = format_timestamp (timestamp, &local_error);
if (!str)
errx (1, "Failed to read commit: %s", local_error->message);
+ g_autofree char *contents = ostree_commit_get_content_checksum (variant) ?: "<invalid commit>";
+ g_print ("ContentChecksum: %s\n", contents);
g_print ("Date: %s\n", str);
if ((version = ot_admin_checksum_version (variant)))