submodule: submodule_move_head omits old argument in forced case
[gitweb.git] / builtin / submodule--helper.c
index 8a0b955a5d9a024e8dd0d0165c997d4174699611..a5c4a8a6941d46c78e4dc58d0df47532f0bb2b45 100644 (file)
@@ -27,9 +27,8 @@ typedef void (*each_submodule_fn)(const struct cache_entry *list_item,
 static char *get_default_remote(void)
 {
        char *dest = NULL, *ret;
-       unsigned char sha1[20];
        struct strbuf sb = STRBUF_INIT;
-       const char *refname = resolve_ref_unsafe("HEAD", 0, sha1, NULL);
+       const char *refname = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
 
        if (!refname)
                die(_("No such ref: %s"), "HEAD");
@@ -1327,8 +1326,7 @@ static const char *remote_submodule_branch(const char *path)
                return "master";
 
        if (!strcmp(branch, ".")) {
-               unsigned char sha1[20];
-               const char *refname = resolve_ref_unsafe("HEAD", 0, sha1, NULL);
+               const char *refname = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
 
                if (!refname)
                        die(_("No such ref: %s"), "HEAD");
@@ -1384,7 +1382,7 @@ static int push_check(int argc, const char **argv, const char *prefix)
        argv++;
        argc--;
        /* Get the submodule's head ref and determine if it is detached */
-       head = resolve_refdup("HEAD", 0, head_oid.hash, NULL);
+       head = resolve_refdup("HEAD", 0, &head_oid, NULL);
        if (!head)
                die(_("Failed to resolve HEAD as a valid ref."));
        if (!strcmp(head, "HEAD"))
@@ -1427,6 +1425,7 @@ static int push_check(int argc, const char **argv, const char *prefix)
                                                break;
                                        die("HEAD does not match the named branch in the superproject");
                                }
+                               /* fallthrough */
                        default:
                                die("src refspec '%s' must name a ref",
                                    rs->src);