core: unpack: Add --keep-packs option
Matches the pack --keep-all-loose.
This commit is contained in:
parent
a04ef7ba10
commit
efc2810f02
|
|
@ -31,7 +31,10 @@
|
||||||
#include <gio/gunixinputstream.h>
|
#include <gio/gunixinputstream.h>
|
||||||
#include <gio/gunixoutputstream.h>
|
#include <gio/gunixoutputstream.h>
|
||||||
|
|
||||||
|
static gboolean opt_keep_packs;
|
||||||
|
|
||||||
static GOptionEntry options[] = {
|
static GOptionEntry options[] = {
|
||||||
|
{ "keep-packs", 0, 0, G_OPTION_ARG_NONE, &opt_keep_packs, "Don't delete pack files", NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -219,6 +222,8 @@ ostree_builtin_unpack (int argc, char **argv, GFile *repo_path, GError **error)
|
||||||
if (!ostree_repo_commit_transaction (repo, cancellable, error))
|
if (!ostree_repo_commit_transaction (repo, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
if (!opt_keep_packs)
|
||||||
|
{
|
||||||
if (g_hash_table_size (meta_packfiles_to_delete) == 0
|
if (g_hash_table_size (meta_packfiles_to_delete) == 0
|
||||||
&& g_hash_table_size (data_packfiles_to_delete) == 0)
|
&& g_hash_table_size (data_packfiles_to_delete) == 0)
|
||||||
g_print ("No pack files; nothing to do\n");
|
g_print ("No pack files; nothing to do\n");
|
||||||
|
|
@ -247,6 +252,9 @@ ostree_builtin_unpack (int argc, char **argv, GFile *repo_path, GError **error)
|
||||||
|
|
||||||
if (!ostree_repo_regenerate_pack_index (repo, cancellable, error))
|
if (!ostree_repo_regenerate_pack_index (repo, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_print ("Unpacked %" G_GUINT64_FORMAT " objects\n", unpacked_object_count);
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
out:
|
out:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue