checkout: rename 'new' variables
[gitweb.git] / builtin / replace.c
index fba336a68a375e20e9b40d332eb58a3f302249fa..42cf4f62a43f21f0ffafb5460a71fa2c661f988d 100644 (file)
@@ -50,14 +50,14 @@ static int show_reference(const char *refname, const struct object_id *oid,
                        struct object_id object;
                        enum object_type obj_type, repl_type;
 
-                       if (get_sha1(refname, object.hash))
+                       if (get_oid(refname, &object))
                                return error("Failed to resolve '%s' as a valid ref.", refname);
 
                        obj_type = sha1_object_info(object.hash, NULL);
                        repl_type = sha1_object_info(oid->hash, NULL);
 
-                       printf("%s (%s) -> %s (%s)\n", refname, typename(obj_type),
-                              oid_to_hex(oid), typename(repl_type));
+                       printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
+                              oid_to_hex(oid), type_name(repl_type));
                }
        }
 
@@ -113,7 +113,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)
                strbuf_addstr(&ref, oid_to_hex(&oid));
                full_hex = ref.buf + base_len;
 
-               if (read_ref(ref.buf, oid.hash)) {
+               if (read_ref(ref.buf, &oid)) {
                        error("replace ref '%s' not found.", full_hex);
                        had_error = 1;
                        continue;
@@ -128,7 +128,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)
 static int delete_replace_ref(const char *name, const char *ref,
                              const struct object_id *oid)
 {
-       if (delete_ref(NULL, ref, oid->hash, 0))
+       if (delete_ref(NULL, ref, oid, 0))
                return 1;
        printf("Deleted replace ref '%s'\n", name);
        return 0;
@@ -144,7 +144,7 @@ static void check_ref_valid(struct object_id *object,
        if (check_refname_format(ref->buf, 0))
                die("'%s' is not a valid ref name.", ref->buf);
 
-       if (read_ref(ref->buf, prev->hash))
+       if (read_ref(ref->buf, prev))
                oidclr(prev);
        else if (!force)
                die("replace ref '%s' already exists", ref->buf);
@@ -168,14 +168,14 @@ static int replace_object_oid(const char *object_ref,
                die("Objects must be of the same type.\n"
                    "'%s' points to a replaced object of type '%s'\n"
                    "while '%s' points to a replacement object of type '%s'.",
-                   object_ref, typename(obj_type),
-                   replace_ref, typename(repl_type));
+                   object_ref, type_name(obj_type),
+                   replace_ref, type_name(repl_type));
 
        check_ref_valid(object, &prev, &ref, force);
 
        transaction = ref_transaction_begin(&err);
        if (!transaction ||
-           ref_transaction_update(transaction, ref.buf, repl->hash, prev.hash,
+           ref_transaction_update(transaction, ref.buf, repl, &prev,
                                   0, NULL, &err) ||
            ref_transaction_commit(transaction, &err))
                die("%s", err.buf);
@@ -215,7 +215,7 @@ static void export_object(const struct object_id *oid, enum object_type type,
        argv_array_push(&cmd.args, "--no-replace-objects");
        argv_array_push(&cmd.args, "cat-file");
        if (raw)
-               argv_array_push(&cmd.args, typename(type));
+               argv_array_push(&cmd.args, type_name(type));
        else
                argv_array_push(&cmd.args, "-p");
        argv_array_push(&cmd.args, oid_to_hex(oid));
@@ -269,7 +269,7 @@ static void import_object(struct object_id *oid, enum object_type type,
 
                if (fstat(fd, &st) < 0)
                        die_errno("unable to fstat %s", filename);
-               if (index_fd(oid->hash, fd, &st, type, NULL, flags) < 0)
+               if (index_fd(oid, fd, &st, type, NULL, flags) < 0)
                        die("unable to write object to database");
                /* index_fd close()s fd for us */
        }
@@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,
        struct tag *tag;
        int i;
 
-       hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);
+       hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), tag_oid.hash);
        tag = lookup_tag(&tag_oid);
        if (!tag)
                die(_("bad mergetag in commit '%s'"), ref);
@@ -365,7 +365,7 @@ static void check_one_mergetag(struct commit *commit,
        /* iterate over new parents */
        for (i = 1; i < mergetag_data->argc; i++) {
                struct object_id oid;
-               if (get_sha1(mergetag_data->argv[i], oid.hash) < 0)
+               if (get_oid(mergetag_data->argv[i], &oid) < 0)
                        die(_("Not a valid object name: '%s'"), mergetag_data->argv[i]);
                if (!oidcmp(&tag->tagged->oid, &oid))
                        return; /* found */