diff options
author | Alexander Larsson <alexl@redhat.com> | 2016-04-18 14:26:02 +0200 |
---|---|---|
committer | Colin Walters (automation) <walters+githubbot@verbum.org> | 2016-04-19 12:28:06 +0000 |
commit | 5595664e47a483512a39a643adb54c523b77de97 (patch) | |
tree | b149331a22743a7f0a7a34b377031a0015bc3151 /src/libostree/ostree-repo-libarchive.c | |
parent | 5079f70ec07d695dc636b34728dc504426db61ea (diff) | |
download | ostree-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/libostree/ostree-repo-libarchive.c')
-rw-r--r-- | src/libostree/ostree-repo-libarchive.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-libarchive.c b/src/libostree/ostree-repo-libarchive.c index 6e6e9806..6856e94b 100644 --- a/src/libostree/ostree-repo-libarchive.c +++ b/src/libostree/ostree-repo-libarchive.c @@ -480,6 +480,12 @@ file_to_archive_entry_common (GFile *root, g_autoptr(GVariant) xattrs = NULL; time_t ts = (time_t) opts->timestamp_secs; + if (opts->path_prefix && opts->path_prefix[0]) + { + g_autofree char *old_pathstr = pathstr; + pathstr = g_strconcat (opts->path_prefix, old_pathstr, NULL); + } + if (pathstr == NULL || !pathstr[0]) { g_free (pathstr); |