From 76ae779635afcd3984dedc57fa7c0e80c6410bba Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 29 Mar 2019 14:39:34 +0000 Subject: [PATCH] rebase: Support identical checksum rebases Change things to only throw this error for non-checksum rebases; for RHEL CoreOS + https://github.com/openshift/pivot/ we've had it happen that the same ostree commit can end up in separate oscontainers. We want to support changing the custom origin that might point to the same commit. --- src/daemon/rpmostreed-transaction-types.c | 12 +++++++++--- src/daemon/rpmostreed-utils.c | 10 ---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/daemon/rpmostreed-transaction-types.c b/src/daemon/rpmostreed-transaction-types.c index 9edfeecb..86112d1b 100644 --- a/src/daemon/rpmostreed-transaction-types.c +++ b/src/daemon/rpmostreed-transaction-types.c @@ -100,9 +100,6 @@ change_origin_refspec (GVariantDict *options, error)) return FALSE; - if (strcmp (current_refspec, new_refspec) == 0) - return glnx_throw (error, "Old and new refs are equal: %s", new_refspec); - /* Re-classify after canonicalization to ensure we handle TYPE_CHECKSUM */ if (!rpmostree_refspec_classify (new_refspec, &refspectype, &refspecdata, error)) return FALSE; @@ -128,6 +125,15 @@ change_origin_refspec (GVariantDict *options, } else { + /* We only throw this error for non-checksum rebases; for + * RHEL CoreOS + https://github.com/openshift/pivot/ + * we've had it happen that the same ostree commit can end up + * in separate oscontainers. We want to support changing + * the custom origin that might point to the same commit. + */ + if (strcmp (current_refspec, new_refspec) == 0) + return glnx_throw (error, "Old and new refs are equal: %s", new_refspec); + if (!rpmostree_origin_set_rebase (origin, new_refspec, error)) return FALSE; } diff --git a/src/daemon/rpmostreed-utils.c b/src/daemon/rpmostreed-utils.c index 686965a3..19b45a01 100644 --- a/src/daemon/rpmostreed-utils.c +++ b/src/daemon/rpmostreed-utils.c @@ -202,16 +202,6 @@ rpmostreed_refspec_parse_partial (const gchar *new_provided_refspec, } } - if (g_strcmp0 (origin_remote, remote) == 0 && - g_strcmp0 (origin_ref, ref) == 0) - { - g_set_error (error, RPM_OSTREED_ERROR, - RPM_OSTREED_ERROR_INVALID_REFSPEC, - "Old and new refs are equal: %s:%s", - remote, ref); - return FALSE; - } - if (remote == NULL) *out_refspec = g_steal_pointer (&ref); else -- 2.20.1