Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-09 Thread Aaron Schrab
At 09:47 -0700 09 Apr 2013, Junio C Hamano wrote: Aaron Schrab writes: But if others disagree, I could be convinced to add support for that. If M/.git weren't a gitfile that points elsewhere, that request ought to work, no? A gitfile is the moral equilvalent of a symbolic link, meant to hel

Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-09 Thread Junio C Hamano
Aaron Schrab writes: > At 17:24 -0700 08 Apr 2013, Jonathan Nieder wrote: >>> +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? > > That

Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-09 Thread Aaron Schrab
At 17:24 -0700 08 Apr 2013, Jonathan Nieder wrote: +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? That isn't supported and I wouldn't e

Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-08 Thread Jonathan Nieder
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 altern

[PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-08 Thread Aaron Schrab
Try reading gitfile files when processing --reference options to clone. This will allow, among other things, using a submodule checked out with a recent version of git as a reference repository without requiring the user to have internal knowledge of submodule layout. Signed-off-by: Aaron Schrab

Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-08 Thread Aaron Schrab
At 11:00 -0700 08 Apr 2013, Junio C Hamano wrote: Aaron Schrab writes: Good catch. I'll fix that in the next version. Thanks. The patch otherwise looks good to me. Great, I'll plan to send version 2 of this series later today. -- To unsubscribe from this list: send the line "unsubscribe

Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-08 Thread Junio C Hamano
[ADMINISTRIVIA: please do not redirect a direct reply to you to other people using Mail-Followup-To.] Aaron Schrab writes: > At 16:51 -0700 07 Apr 2013, Jonathan Nieder wrote: >>> - char *ref_git; >>> + char *ref_git, *repo; >>[...] >>> + repo = (char *)read_gitfile(mkpath("%s/.git", ref_

Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-07 Thread Aaron Schrab
At 16:51 -0700 07 Apr 2013, Jonathan Nieder wrote: - char *ref_git; + char *ref_git, *repo; [...] + repo = (char *)read_gitfile(mkpath("%s/.git", ref_git)); Why not make repo a "const char *" and avoid the cast? The above would seem to make it too tempting to treat the ret

Re: [PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-07 Thread Jonathan Nieder
Aaron Schrab wrote: > --- a/builtin/clone.c > +++ b/builtin/clone.c > @@ -231,12 +231,19 @@ static void strip_trailing_slashes(char *dir) > > static int add_one_reference(struct string_list_item *item, void *cb_data) > { > - char *ref_git; > + char *ref_git, *repo; [...] > + repo =

[PATCH 2/2] clone: Allow repo using gitfile as a reference

2013-04-07 Thread Aaron Schrab
Try reading gitfile files when processing --reference options to clone. This will allow, among other things, using a submodule checked out with a recent version of git as a reference repository without requiring the user to have internal knowledge of submodule layout. Signed-off-by: Aaron Schrab