]> git.ipfire.org Git - thirdparty/git.git/blobdiff - unpack-trees.c
sha1-file: support OBJECT_INFO_FOR_PREFETCH
[thirdparty/git.git] / unpack-trees.c
index 22c41a3ba80971e5edc6bbf02eb6ea59d3c41277..381b0cd65e3bb12412a8624bff83ff557ee71807 100644 (file)
@@ -404,20 +404,21 @@ static int check_updates(struct unpack_trees_options *o)
                 * below.
                 */
                struct oid_array to_fetch = OID_ARRAY_INIT;
-               int fetch_if_missing_store = fetch_if_missing;
-               fetch_if_missing = 0;
                for (i = 0; i < index->cache_nr; i++) {
                        struct cache_entry *ce = index->cache[i];
-                       if ((ce->ce_flags & CE_UPDATE) &&
-                           !S_ISGITLINK(ce->ce_mode)) {
-                               if (!has_object_file(&ce->oid))
-                                       oid_array_append(&to_fetch, &ce->oid);
-                       }
+
+                       if (!(ce->ce_flags & CE_UPDATE) ||
+                           S_ISGITLINK(ce->ce_mode))
+                               continue;
+                       if (!oid_object_info_extended(the_repository, &ce->oid,
+                                                     NULL,
+                                                     OBJECT_INFO_FOR_PREFETCH))
+                               continue;
+                       oid_array_append(&to_fetch, &ce->oid);
                }
                if (to_fetch.nr)
                        fetch_objects(repository_format_partial_clone,
                                      to_fetch.oid, to_fetch.nr);
-               fetch_if_missing = fetch_if_missing_store;
                oid_array_clear(&to_fetch);
        }
        for (i = 0; i < index->cache_nr; i++) {