summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-export.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-04-18 14:26:02 +0200
committerColin Walters (automation) <walters+githubbot@verbum.org>2016-04-19 12:28:06 +0000
commit5595664e47a483512a39a643adb54c523b77de97 (patch)
treeb149331a22743a7f0a7a34b377031a0015bc3151 /src/ostree/ot-builtin-export.c
parent5079f70ec07d695dc636b34728dc504426db61ea (diff)
downloadostree-5595664e47a483512a39a643adb54c523b77de97.tar.gz
ostree export: Add --prefix option
This lets you set a prefix for the resulting archive patsh. Especially useful in combination with --subpath, for instance --subpath=subdir --prefix=subdir to extract just subdir. Closes: #265 Approved by: cgwalters
Diffstat (limited to 'src/ostree/ot-builtin-export.c')
-rw-r--r--src/ostree/ot-builtin-export.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ostree/ot-builtin-export.c b/src/ostree/ot-builtin-export.c
index 9a7842ab..5b84d1ab 100644
--- a/src/ostree/ot-builtin-export.c
+++ b/src/ostree/ot-builtin-export.c
@@ -33,11 +33,13 @@
static char *opt_output_path;
static char *opt_subpath;
+static char *opt_prefix;
static gboolean opt_no_xattrs;
static GOptionEntry options[] = {
{ "no-xattrs", 0, 0, G_OPTION_ARG_NONE, &opt_no_xattrs, "Skip output of extended attributes", NULL },
{ "subpath", 0, 0, G_OPTION_ARG_STRING, &opt_subpath, "Checkout sub-directory PATH", "PATH" },
+ { "prefix", 0, 0, G_OPTION_ARG_STRING, &opt_prefix, "Add PATH as prefix to archive pathnames", "PATH" },
{ "output", 'o', 0, G_OPTION_ARG_STRING, &opt_output_path, "Output to PATH ", "PATH" },
{ NULL }
};
@@ -132,6 +134,8 @@ ostree_builtin_export (int argc, char **argv, GCancellable *cancellable, GError
else
subtree = g_object_ref (root);
+ opts.path_prefix = opt_prefix;
+
if (!ostree_repo_export_tree_to_archive (repo, &opts, (OstreeRepoFile*)subtree, a,
cancellable, error))
goto out;