Show 25 quoted lines
> On Fri, Apr 15, 2016 at 3:19 PM, David Turner <
> dturner@twopensource.com> wrote:
> > For single-branch clones (when we know in advance what the remote
> > branch name will be), send a refspec so that the server doesn't
> > tell us about any other refs.
> >
> > Signed-off-by: David Turner <dturner@twopensource.com>
> > ---
> > diff --git a/builtin/clone.c b/builtin/clone.c
> > @@ -1010,7 +1010,21 @@ int cmd_clone(int argc, const char **argv,
> > const char *prefix)
> > + if (option_single_branch && option_branch) {
> > + struct refspec branch_refspec = {0};
> > +
> > + if (starts_with(option_branch, "refs/")) {
> > + branch_refspec.src =
> > xstrdup(option_branch);
> > + } else {
> > + struct strbuf buf = STRBUF_INIT;
> > + strbuf_addf(&buf, "refs/heads/%s",
> > option_branch);
> > + branch_refspec.src = strbuf_detach(&buf,
> > NULL);
>
> branch_refspec.src = xstrfmt("refs/heads/%s", option_branch);