[ostree] pull: Always scan for commit object, even if ref is unchanged
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] pull: Always scan for commit object, even if ref is unchanged
- Date: Tue, 23 Jul 2013 23:40:49 +0000 (UTC)
commit 688d8f176b6c6d566226ca29304ecfd53c199889
Author: Colin Walters <walters verbum org>
Date: Tue Jul 23 19:36:15 2013 -0400
pull: Always scan for commit object, even if ref is unchanged
If the admin encounters corruption and does:
$ ostree admin fsck --delete
We want them to be able to recover the objects easily from the
network; with this patch, they do:
$ ln -s dummyvalue /ostree/repo/transaction
$ ostree refs --delete remotename:branchname
$ ostree pull remotename
This patch avoids the need for the refs --delete; we might as well
force scan the commit, and with this patch we still print that it
changed.
src/libostree/ostree-repo-pull.c | 38 ++++++++++++++++++--------------------
1 files changed, 18 insertions(+), 20 deletions(-)
---
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 9f38ed3..a270d1c 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -1356,24 +1356,11 @@ ostree_repo_pull (OstreeRepo *repo,
gs_free char *key = NULL;
gs_free char *remote_ref = NULL;
gs_free char *baseurl = NULL;
- gs_free char *original_rev = NULL;
-
- remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref);
- if (!ostree_repo_resolve_rev (pull_data->repo, remote_ref, TRUE, &original_rev, error))
- goto out;
-
- if (original_rev && strcmp (sha256, original_rev) == 0)
- {
- g_print ("No changes in %s\n", remote_ref);
- }
- else
- {
- ot_waitable_queue_push (pull_data->metadata_objects_to_scan,
- pull_worker_message_new (PULL_MSG_SCAN,
- ostree_object_name_serialize (sha256,
OSTREE_OBJECT_TYPE_COMMIT)));
- g_hash_table_insert (updated_refs, g_strdup (ref), g_strdup (sha256));
- }
+ ot_waitable_queue_push (pull_data->metadata_objects_to_scan,
+ pull_worker_message_new (PULL_MSG_SCAN,
+ ostree_object_name_serialize (sha256,
OSTREE_OBJECT_TYPE_COMMIT)));
+ g_hash_table_insert (updated_refs, g_strdup (ref), g_strdup (sha256));
}
{
@@ -1401,13 +1388,24 @@ ostree_repo_pull (OstreeRepo *repo,
const char *ref = key;
const char *checksum = value;
gs_free char *remote_ref = NULL;
+ gs_free char *original_rev = NULL;
remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref);
-
- if (!ostree_repo_write_ref (pull_data->repo, pull_data->remote_name, ref, checksum, error))
+
+ if (!ostree_repo_resolve_rev (pull_data->repo, remote_ref, TRUE, &original_rev, error))
goto out;
- g_print ("remote %s is now %s\n", remote_ref, checksum);
+ if (original_rev && strcmp (checksum, original_rev) == 0)
+ {
+ g_print ("remote %s is unchanged from %s\n", remote_ref, original_rev);
+ }
+ else
+ {
+ if (!ostree_repo_write_ref (pull_data->repo, pull_data->remote_name, ref, checksum, error))
+ goto out;
+
+ g_print ("remote %s is now %s\n", remote_ref, checksum);
+ }
}
end_time = g_get_monotonic_time ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]