format-patch: add --interdiff option to embed diff in cover letter
[gitweb.git] / builtin / replace.c
index a87fca045be831c2e14b0c4977d48f205833bace..deabda210127087188117e394e453373fa48991f 100644 (file)
@@ -14,6 +14,8 @@
 #include "refs.h"
 #include "parse-options.h"
 #include "run-command.h"
+#include "object-store.h"
+#include "repository.h"
 #include "tag.h"
 
 static const char * const git_replace_usage[] = {
@@ -54,8 +56,9 @@ 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(&object, NULL);
-                       repl_type = oid_object_info(oid, NULL);
+                       obj_type = oid_object_info(the_repository, &object,
+                                                  NULL);
+                       repl_type = oid_object_info(the_repository, oid, NULL);
 
                        printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
                               oid_to_hex(oid), type_name(repl_type));
@@ -84,7 +87,7 @@ static int list_replace_refs(const char *pattern, const char *format)
                             "valid formats are 'short', 'medium' and 'long'\n",
                             format);
 
-       for_each_replace_ref(show_reference, (void *)&data);
+       for_each_replace_ref(the_repository, show_reference, (void *)&data);
 
        return 0;
 }
@@ -165,8 +168,8 @@ static int replace_object_oid(const char *object_ref,
        struct strbuf err = STRBUF_INIT;
        int res = 0;
 
-       obj_type = oid_object_info(object, NULL);
-       repl_type = oid_object_info(repl, NULL);
+       obj_type = oid_object_info(the_repository, object, NULL);
+       repl_type = oid_object_info(the_repository, repl, NULL);
        if (!force && obj_type != repl_type)
                return error("Objects must be of the same type.\n"
                             "'%s' points to a replaced object of type '%s'\n"
@@ -314,7 +317,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
        if (get_oid(object_ref, &old_oid) < 0)
                return error("Not a valid object name: '%s'", object_ref);
 
-       type = oid_object_info(&old_oid, NULL);
+       type = oid_object_info(the_repository, &old_oid, NULL);
        if (type < 0)
                return error("unable to get object type for %s",
                             oid_to_hex(&old_oid));
@@ -484,7 +487,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
 
 static int convert_graft_file(int force)
 {
-       const char *graft_file = get_graft_file();
+       const char *graft_file = get_graft_file(the_repository);
        FILE *fp = fopen_or_warn(graft_file, "r");
        struct strbuf buf = STRBUF_INIT, err = STRBUF_INIT;
        struct argv_array args = ARGV_ARRAY_INIT;