clone: support 'clone --shared' from a worktree
[gitweb.git] / builtin / clone.c
index 3e14491a340cdce70308b31cdf96612344644c15..69eabc0d8802804d59bd03d443bdcd8b8a1da750 100644 (file)
@@ -423,7 +423,8 @@ static void clone_local(const char *src_repo, const char *dest_repo)
 {
        if (option_shared) {
                struct strbuf alt = STRBUF_INIT;
-               strbuf_addf(&alt, "%s/objects", src_repo);
+               get_common_dir(&alt, src_repo);
+               strbuf_addstr(&alt, "/objects");
                add_to_alternates_file(alt.buf);
                strbuf_release(&alt);
        } else {