static gboolean opt_disable_fsync = FALSE;
static char *opt_destination_repo = NULL;
+static char *opt_commit = NULL;
static GOptionEntry options[] =
{
{ "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
{ "destination-repo", 0, 0, G_OPTION_ARG_FILENAME, &opt_destination_repo, "Use custom repository directory within the mount", "DEST" },
+ { "commit", 0, 0, G_OPTION_ARG_STRING, &opt_commit, "Pull a specific commit (only works when a single ref is specified)", "COMMIT" },
{ NULL }
};
return FALSE;
}
+ if (opt_commit && argc > 4)
+ {
+ ot_util_usage_error (context, "The --commit option can only be used when a single COLLECTION-ID REF pair is specified", error);
+ return FALSE;
+ }
+
/* Open the USB stick, which must exist. Allow automounting and following symlinks. */
const char *mount_root_path = argv[1];
struct stat mount_root_stbuf;
const OstreeCollectionRef *ref = g_ptr_array_index (refs, i);
g_variant_builder_add (&refs_builder, "(sss)",
- ref->collection_id, ref->ref_name, "");
+ ref->collection_id, ref->ref_name, opt_commit ?: "");
}
{