]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/replace.c
completion: use __gitcomp_builtin in _git_replace
[thirdparty/git.git] / builtin / replace.c
index 3e71a771523d8566590bfbd5de71b08acf79e3a4..0c1d8e1b081333b5f582dd42b5ef97101b54eb9e 100644 (file)
@@ -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);
@@ -175,7 +175,7 @@ static int replace_object_oid(const char *object_ref,
 
        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);
@@ -439,7 +439,8 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
                OPT_CMDMODE('d', "delete", &cmdmode, N_("delete replace refs"), MODE_DELETE),
                OPT_CMDMODE('e', "edit", &cmdmode, N_("edit existing object"), MODE_EDIT),
                OPT_CMDMODE('g', "graft", &cmdmode, N_("change a commit's parents"), MODE_GRAFT),
-               OPT_BOOL('f', "force", &force, N_("replace the ref if it exists")),
+               OPT_BOOL_F('f', "force", &force, N_("replace the ref if it exists"),
+                          PARSE_OPT_NOCOMPLETE),
                OPT_BOOL(0, "raw", &raw, N_("do not pretty-print contents for --edit")),
                OPT_STRING(0, "format", &format, N_("format"), N_("use this format")),
                OPT_END()