summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-reset.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2015-04-07 20:54:37 -0400
committerColin Walters <walters@verbum.org>2015-04-15 07:12:20 -0400
commitab15eafe56fc4e237010a967a31740558a493ab8 (patch)
tree7d4ff34ca0b127b8c7367b00ed63212cbf28ec39 /src/ostree/ot-builtin-reset.c
parente5e0b95e27bf8c2c72938aaea95eacebea14c40b (diff)
downloadostree-ab15eafe56fc4e237010a967a31740558a493ab8.tar.gz
reset: Don't enforce parent commits
First, git doesn't do this, and whatever Linus thinks is right or something. Second specifically to OSTree, it's quite common to not have intermediate commits. If one wants to reset a ref in order to prune data after a deployment, the parentage check will fail. Closes: https://github.com/GNOME/ostree/pull/87
Diffstat (limited to 'src/ostree/ot-builtin-reset.c')
-rw-r--r--src/ostree/ot-builtin-reset.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/ostree/ot-builtin-reset.c b/src/ostree/ot-builtin-reset.c
index a09e9a4f..71655438 100644
--- a/src/ostree/ot-builtin-reset.c
+++ b/src/ostree/ot-builtin-reset.c
@@ -49,38 +49,6 @@ find_current_ref (OstreeRepo *repo,
return ret;
}
-static gboolean
-check_revision_is_parent (OstreeRepo *repo,
- const char *descendant,
- const char *ancestor,
- GCancellable *cancellable,
- GError **error)
-{
- gs_free char *parent = NULL;
- gs_unref_variant GVariant *variant = NULL;
- gboolean ret = FALSE;
-
- if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT,
- descendant, &variant, error))
- goto out;
-
- parent = ostree_commit_get_parent (variant);
- if (!parent)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "The ref does not have this commit as an ancestor: %s", ancestor);
- goto out;
- }
-
- if (!g_str_equal (parent, ancestor) &&
- !check_revision_is_parent (repo, parent, ancestor, cancellable, error))
- goto out;
-
- ret = TRUE;
-out:
- return ret;
-}
-
gboolean
ostree_builtin_reset (int argc,
char **argv,
@@ -118,9 +86,6 @@ ostree_builtin_reset (int argc,
if (current == NULL)
goto out;
- if (!check_revision_is_parent (repo, current, checksum, cancellable, error))
- goto out;
-
if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
goto out;