register_replace_ref(): rewrite to take an object_id argument
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 25 May 2015 18:39:02 +0000 (18:39 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 May 2015 19:19:35 +0000 (12:19 -0700)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
replace_object.c
index a8a2da9448d7e74679097377adb9d887ca74d359..f0b39f06d5dabc3c98c5c083458736a585b4cabb 100644 (file)
@@ -53,7 +53,7 @@ static int register_replace_object(struct replace_object *replace,
 }
 
 static int register_replace_ref(const char *refname,
-                               const unsigned char *sha1,
+                               const struct object_id *oid,
                                int flag, void *cb_data)
 {
        /* Get sha1 from refname */
@@ -68,7 +68,7 @@ static int register_replace_ref(const char *refname,
        }
 
        /* Copy sha1 from the read ref */
-       hashcpy(repl_obj->replacement, sha1);
+       hashcpy(repl_obj->replacement, oid->hash);
 
        /* Register new object */
        if (register_replace_object(repl_obj, 1))
@@ -80,13 +80,11 @@ static int register_replace_ref(const char *refname,
 static void prepare_replace_object(void)
 {
        static int replace_object_prepared;
-       struct each_ref_fn_sha1_adapter wrapped_register_replace_ref =
-               {register_replace_ref, NULL};
 
        if (replace_object_prepared)
                return;
 
-       for_each_replace_ref(each_ref_fn_adapter, &wrapped_register_replace_ref);
+       for_each_replace_ref(register_replace_ref, NULL);
        replace_object_prepared = 1;
        if (!replace_object_nr)
                check_replace_refs = 0;