clone: better error when --reference is a linked checkout
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 28 Sep 2015 13:06:16 +0000 (20:06 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Sep 2015 17:46:36 +0000 (10:46 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
index 39d4adf7d10e46647b890575a4b45a2ca435b47f..3e14491a340cdce70308b31cdf96612344644c15 100644 (file)
@@ -294,9 +294,14 @@ static int add_one_reference(struct string_list_item *item, void *cb_data)
                char *ref_git_git = mkpathdup("%s/.git", ref_git);
                free(ref_git);
                ref_git = ref_git_git;
-       } else if (!is_directory(mkpath("%s/objects", ref_git)))
+       } else if (!is_directory(mkpath("%s/objects", ref_git))) {
+               struct strbuf sb = STRBUF_INIT;
+               if (get_common_dir(&sb, ref_git))
+                       die(_("reference repository '%s' as a linked checkout is not supported yet."),
+                           item->string);
                die(_("reference repository '%s' is not a local repository."),
                    item->string);
+       }
 
        if (!access(mkpath("%s/shallow", ref_git), F_OK))
                die(_("reference repository '%s' is shallow"), item->string);