Merge branch 'jc/am-i-v-fix' into maint
[gitweb.git] / builtin / replace.c
index 0d52e7fa1d394d3c39437010592e4de428f53b34..748c6ca954679e3fc47c25991dd50e539eaa543d 100644 (file)
@@ -104,9 +104,9 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)
                        continue;
                }
                full_hex = sha1_to_hex(sha1);
-               snprintf(ref, sizeof(ref), "refs/replace/%s", full_hex);
+               snprintf(ref, sizeof(ref), "%s%s", git_replace_ref_base, full_hex);
                /* read_ref() may reuse the buffer */
-               full_hex = ref + strlen("refs/replace/");
+               full_hex = ref + strlen(git_replace_ref_base);
                if (read_ref(ref, sha1)) {
                        error("replace ref '%s' not found.", full_hex);
                        had_error = 1;
@@ -134,7 +134,7 @@ static void check_ref_valid(unsigned char object[20],
                            int force)
 {
        if (snprintf(ref, ref_size,
-                    "refs/replace/%s",
+                    "%s%s", git_replace_ref_base,
                     sha1_to_hex(object)) > ref_size - 1)
                die("replace ref name too long: %.*s...", 50, ref);
        if (check_refname_format(ref, 0))
@@ -358,10 +358,10 @@ static void check_one_mergetag(struct commit *commit,
 
        /* iterate over new parents */
        for (i = 1; i < mergetag_data->argc; i++) {
-               unsigned char sha1[20];
-               if (get_sha1(mergetag_data->argv[i], sha1) < 0)
+               struct object_id oid;
+               if (get_sha1(mergetag_data->argv[i], oid.hash) < 0)
                        die(_("Not a valid object name: '%s'"), mergetag_data->argv[i]);
-               if (!hashcmp(tag->tagged->sha1, sha1))
+               if (!oidcmp(&tag->tagged->oid, &oid))
                        return; /* found */
        }