Re: [PATCH/RFC 6/6] clone: send refspec for single-branch clones
From: David Turner <hidden>
Date: 2016-06-16 02:18:52
On Sat, 2016-04-16 at 22:36 -0400, Eric Sunshine wrote:
On Fri, Apr 15, 2016 at 3:19 PM, David Turner < dturner@twopensource.com> wrote:quoted
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 <redacted> ---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);
Will fix, thanks.