Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 9, 2013, 00:24 UTC
- Message-ID
- <20130409002456.GW30308@google.com>
- In-Reply-To
- <1365461200-13509-3-git-send-email-aaron@schrab.com>
Aaron Schrab wrote:
Show 15 quoted lines
> --- 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));[...]
Show 8 quoted lines
> +++ 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 <jrnieder@gmail.com>