]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/submodule--helper.c
Merge branch 'jk/loose-object-cache'
[thirdparty/git.git] / builtin / submodule--helper.c
index d38113a31aeb3838190b7339475c7454e45f3a89..b45514be317eafb765a8943241b5d880f65e3117 100644 (file)
@@ -1265,19 +1265,20 @@ struct submodule_alternate_setup {
        SUBMODULE_ALTERNATE_ERROR_IGNORE, NULL }
 
 static int add_possible_reference_from_superproject(
-               struct alternate_object_database *alt, void *sas_cb)
+               struct object_directory *odb, void *sas_cb)
 {
        struct submodule_alternate_setup *sas = sas_cb;
+       size_t len;
 
        /*
         * If the alternate object store is another repository, try the
         * standard layout with .git/(modules/<name>)+/objects
         */
-       if (ends_with(alt->path, "/objects")) {
+       if (strip_suffix(odb->path, "/objects", &len)) {
                char *sm_alternate;
                struct strbuf sb = STRBUF_INIT;
                struct strbuf err = STRBUF_INIT;
-               strbuf_add(&sb, alt->path, strlen(alt->path) - strlen("objects"));
+               strbuf_add(&sb, odb->path, len);
 
                /*
                 * We need to end the new path with '/' to mark it as a dir,
@@ -1285,7 +1286,7 @@ static int add_possible_reference_from_superproject(
                 * as the last part of a missing submodule reference would
                 * be taken as a file name.
                 */
-               strbuf_addf(&sb, "modules/%s/", sas->submodule_name);
+               strbuf_addf(&sb, "/modules/%s/", sas->submodule_name);
 
                sm_alternate = compute_alternate_path(sb.buf, &err);
                if (sm_alternate) {