[ostree/wip/packfile-rebase2] pull from remote packs works



commit a2bd5345752677b2f8286f7640a95210d64ab6e9
Author: Colin Walters <walters verbum org>
Date:   Fri Mar 30 17:29:08 2012 -0400

    pull from remote packs works

 src/libostree/ostree-repo.c |    2 +-
 src/ostree/ostree-pull.c    |    5 +++++
 tests/t0010-pull.sh         |   19 ++++++++++++++++++-
 3 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 914e82b..1461869 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -2109,7 +2109,7 @@ ostree_repo_add_cached_remote_pack_index (OstreeRepo       *self,
   if (!ensure_remote_cache_dir (self, remote_name, &cachedir, cancellable, error))
     goto out;
   
-  cached_path = get_pack_index_name_from_checksum (cachedir, pack_checksum);
+  target_path = get_pack_index_name_from_checksum (cachedir, pack_checksum);
   if (!ot_util_variant_save (target_path, output_index_variant, cancellable, error))
     goto out;
 
diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c
index 467b980..9d092c8 100644
--- a/src/ostree/ostree-pull.c
+++ b/src/ostree/ostree-pull.c
@@ -478,6 +478,8 @@ find_object (OtPullData        *pull_data,
     *out_is_stored = ret_is_stored;
   if (out_is_pending)
     *out_is_pending = ret_is_pending;
+  if (out_offset)
+    *out_offset = offset;
   ot_transfer_out_value (out_remote_pack_checksum, &ret_remote_pack_checksum);
  out:
   g_free (local_pack_checksum);
@@ -538,6 +540,9 @@ fetch_object_if_not_stored (OtPullData           *pull_data,
         goto out;
 
       ret_input = ostree_read_pack_entry_as_stream (pack_entry);
+      g_object_set_data_full ((GObject*)ret_input, "ostree-pull-pack-map",
+                              pack_map, (GDestroyNotify) g_mapped_file_unref);
+      pack_map = NULL; /* Transfer ownership */
     }
   else if (!(ret_is_stored || ret_is_pending))
     {
diff --git a/tests/t0010-pull.sh b/tests/t0010-pull.sh
index 53c85b2..43e39c1 100755
--- a/tests/t0010-pull.sh
+++ b/tests/t0010-pull.sh
@@ -21,7 +21,7 @@ set -e
 
 . libtest.sh
 
-echo '1..2'
+echo '1..4'
 
 setup_fake_remote_repo1
 cd ${test_tmpdir}
@@ -37,3 +37,20 @@ cd checkout-origin-main
 assert_file_has_content firstfile '^first$'
 assert_file_has_content baz/cow '^moo$'
 echo "ok pull contents"
+
+cd ${test_tmpdir}
+ostree --repo=$(pwd)/ostree-srv/gnomerepo pack
+rm -rf repo
+mkdir repo
+ostree --repo=repo init
+ostree --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo
+ostree-pull --repo=repo origin main
+echo "ok pull packed"
+
+cd ${test_tmpdir}
+rm -rf checkout-origin-main
+$OSTREE checkout origin/main checkout-origin-main
+cd checkout-origin-main
+assert_file_has_content firstfile '^first$'
+assert_file_has_content baz/cow '^moo$'
+echo "ok pull contents packed"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]