static void dump_commit (GVariant *variant, OstreeDumpFlags flags) { const gchar *subject; const gchar *body; guint64 timestamp; gs_free gchar *str; /* See OSTREE_COMMIT_GVARIANT_FORMAT */ g_variant_get (variant, "(a{sv}aya(say)&s&stayay)", NULL, NULL, NULL, &subject, &body, ×tamp, NULL, NULL); timestamp = GUINT64_FROM_BE (timestamp); str = format_timestamp (timestamp); if (str) g_print ("Date: %s\n", str); g_print ("\n"); dump_indented_lines (subject); if (body[0]) { g_print ("\n"); dump_indented_lines (body); } g_print ("\n"); }
static void dump_commit (GVariant *variant, OstreeDumpFlags flags) { const gchar *subject; const gchar *body; guint64 timestamp; g_autofree char *str = NULL; g_autofree char *version = NULL; g_autoptr(GError) local_error = NULL; /* See OSTREE_COMMIT_GVARIANT_FORMAT */ g_variant_get (variant, "(a{sv}aya(say)&s&stayay)", NULL, NULL, NULL, &subject, &body, ×tamp, NULL, NULL); timestamp = GUINT64_FROM_BE (timestamp); str = format_timestamp (timestamp, &local_error); if (!str) errx (1, "Failed to read commit: %s", local_error->message); g_print ("Date: %s\n", str); if ((version = ot_admin_checksum_version (variant))) { g_print ("Version: %s\n", version); } if (subject[0]) { g_print ("\n"); dump_indented_lines (subject); } else { g_print ("(no subject)\n"); } if (body[0]) { g_print ("\n"); dump_indented_lines (body); } g_print ("\n"); }