Merge branch 'lm/range-diff-submodule-fix'
[gitweb.git] / builtin / replace.c
index 4f05791f3e895f78ba511dd6571bd09abab9269c..a58b9c6d130568602ac7928bd1da4a83724ff4f1 100644 (file)
@@ -39,7 +39,8 @@ struct show_data {
        enum replace_format format;
 };
 
-static int show_reference(const char *refname, const struct object_id *oid,
+static int show_reference(struct repository *r, const char *refname,
+                         const struct object_id *oid,
                          int flag, void *cb_data)
 {
        struct show_data *data = cb_data;
@@ -56,9 +57,8 @@ static int show_reference(const char *refname, const struct object_id *oid,
                        if (get_oid(refname, &object))
                                return error(_("failed to resolve '%s' as a valid ref"), refname);
 
-                       obj_type = oid_object_info(the_repository, &object,
-                                                  NULL);
-                       repl_type = oid_object_info(the_repository, oid, NULL);
+                       obj_type = oid_object_info(r, &object, NULL);
+                       repl_type = oid_object_info(r, oid, NULL);
 
                        printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
                               oid_to_hex(oid), type_name(repl_type));
@@ -295,7 +295,7 @@ static int import_object(struct object_id *oid, enum object_type type,
                        close(fd);
                        return -1;
                }
-               if (index_fd(oid, fd, &st, type, NULL, flags) < 0)
+               if (index_fd(&the_index, oid, fd, &st, type, NULL, flags) < 0)
                        return error(_("unable to write object to database"));
                /* index_fd close()s fd for us */
        }
@@ -343,7 +343,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
        }
        free(tmpfile);
 
-       if (!oidcmp(&old_oid, &new_oid))
+       if (oideq(&old_oid, &new_oid))
                return error(_("new object is the same as the old one: '%s'"), oid_to_hex(&old_oid));
 
        return replace_object_oid(object_ref, &old_oid, "replacement", &new_oid, force);
@@ -414,7 +414,7 @@ static int check_one_mergetag(struct commit *commit,
                if (get_oid(mergetag_data->argv[i], &oid) < 0)
                        return error(_("not a valid object name: '%s'"),
                                     mergetag_data->argv[i]);
-               if (!oidcmp(&tag->tagged->oid, &oid))
+               if (oideq(&tag->tagged->oid, &oid))
                        return 0; /* found */
        }
 
@@ -474,7 +474,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
 
        strbuf_release(&buf);
 
-       if (!oidcmp(&old_oid, &new_oid)) {
+       if (oideq(&old_oid, &new_oid)) {
                if (gentle) {
                        warning(_("graft for '%s' unnecessary"), oid_to_hex(&old_oid));
                        return 0;