From: Jonathan Nieder Date: Tue, 09 Apr 2013 00:24:56 GMT Subject: Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference Message-ID: <20130409002456.GW30308@google.com> In-Reply-To: <1365461200-13509-3-git-send-email-aaron@schrab.com> Aaron Schrab wrote: > --- a/builtin/clone.c > +++ b/builtin/clone.c > @@ -232,11 +232,19 @@ static void strip_trailing_slashes(char *dir) > static int add_one_reference(struct string_list_item *item, void *cb_data) > { > char *ref_git; > + const char *repo; > struct strbuf alternate = STRBUF_INIT; > > - /* Beware: real_path() and mkpath() return static buffer */ > + /* Beware: read_gitfile(), real_path() and mkpath() return static buffer */ > ref_git = xstrdup(real_path(item->string)); > - if (is_directory(mkpath("%s/.git/objects", ref_git))) { > + > + repo = read_gitfile(mkpath("%s/.git", ref_git)); [...] > +++ b/t/t5700-clone-reference.sh > @@ -185,4 +185,11 @@ test_expect_success 'fetch with incomplete alternates' ' > ! grep " want $tag_object" "$U.K" > ' > > +test_expect_success 'clone using repo with gitfile as a reference' ' > + git clone --separate-git-dir=L A M && > + git clone --reference=M A N && What should happen if I pass --reference=M/.git? > + echo "$base_dir/L/objects" > expected && The usual style in tests is to include no space after >redirection operators. With those two changes, Reviewed-by: Jonathan Nieder