]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fetch-pack.c
l10n: tr: v2.34.0 round 3
[thirdparty/git.git] / fetch-pack.c
index b0c7be717c7fdde0d45d58c113172c0f07eac78b..a9604f35a3ea9055732d48e39b63a39f041f18f3 100644 (file)
@@ -119,6 +119,11 @@ static struct commit *deref_without_lazy_fetch(const struct object_id *oid,
 {
        enum object_type type;
        struct object_info info = { .typep = &type };
+       struct commit *commit;
+
+       commit = lookup_commit_in_graph(the_repository, oid);
+       if (commit)
+               return commit;
 
        while (1) {
                if (oid_object_info_extended(the_repository, oid, &info,
@@ -137,8 +142,14 @@ static struct commit *deref_without_lazy_fetch(const struct object_id *oid,
                        break;
                }
        }
-       if (type == OBJ_COMMIT)
-               return (struct commit *) parse_object(the_repository, oid);
+
+       if (type == OBJ_COMMIT) {
+               struct commit *commit = lookup_commit(the_repository, oid);
+               if (!commit || repo_parse_commit(the_repository, commit))
+                       return NULL;
+               return commit;
+       }
+
        return NULL;
 }
 
@@ -1906,16 +1917,15 @@ static void update_shallow(struct fetch_pack_args *args,
        oid_array_clear(&ref);
 }
 
-static int iterate_ref_map(void *cb_data, struct object_id *oid)
+static const struct object_id *iterate_ref_map(void *cb_data)
 {
        struct ref **rm = cb_data;
        struct ref *ref = *rm;
 
        if (!ref)
-               return -1; /* end of the list */
+               return NULL;
        *rm = ref->next;
-       oidcpy(oid, &ref->old_oid);
-       return 0;
+       return &ref->old_oid;
 }
 
 struct ref *fetch_pack(struct fetch_pack_args *args,