Merge branch 'jt/http-auth-proto-v2-fix'
[gitweb.git] / builtin / replace.c
index 4f05791f3e895f78ba511dd6571bd09abab9269c..f5701629a8a5698a64c91ca92226e6da72697441 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));
@@ -82,6 +82,10 @@ static int list_replace_refs(const char *pattern, const char *format)
                data.format = REPLACE_FORMAT_MEDIUM;
        else if (!strcmp(format, "long"))
                data.format = REPLACE_FORMAT_LONG;
+       /*
+        * Please update _git_replace() in git-completion.bash when
+        * you add new format
+        */
        else
                return error(_("invalid replace format '%s'\n"
                               "valid formats are 'short', 'medium' and 'long'"),
@@ -295,7 +299,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_repository->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 +347,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 +418,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 +478,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;
@@ -495,6 +499,7 @@ static int convert_graft_file(int force)
        if (!fp)
                return -1;
 
+       advice_graft_file_deprecated = 0;
        while (strbuf_getline(&buf, fp) != EOF) {
                if (*buf.buf == '#')
                        continue;