Merge branch 'bw/protocol-v2'
The beginning of the next-gen transfer protocol. * bw/protocol-v2: (35 commits) remote-curl: don't request v2 when pushing remote-curl: implement stateless-connect command http: eliminate "# service" line when using protocol v2 http: don't always add Git-Protocol header http: allow providing extra headers for http requests remote-curl: store the protocol version the server responded with remote-curl: create copy of the service name pkt-line: add packet_buf_write_len function transport-helper: introduce stateless-connect transport-helper: refactor process_connect_service transport-helper: remove name parameter connect: don't request v2 when pushing connect: refactor git_connect to only get the protocol version once fetch-pack: support shallow requests fetch-pack: perform a fetch using v2 upload-pack: introduce fetch server command push: pass ref prefixes when pushing fetch: pass ref prefixes when fetching ls-remote: pass ref prefixes when requesting a remote's refs transport: convert transport_get_remote_refs to take a list of ref prefixes ...
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#include "cache.h"
|
||||
#include "transport.h"
|
||||
#include "remote.h"
|
||||
#include "refs.h"
|
||||
|
||||
static const char * const ls_remote_usage[] = {
|
||||
N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
|
||||
@ -43,6 +44,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
|
||||
int show_symref_target = 0;
|
||||
const char *uploadpack = NULL;
|
||||
const char **pattern = NULL;
|
||||
struct argv_array ref_prefixes = ARGV_ARRAY_INIT;
|
||||
|
||||
struct remote *remote;
|
||||
struct transport *transport;
|
||||
@ -75,8 +77,17 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
|
||||
if (argc > 1) {
|
||||
int i;
|
||||
pattern = xcalloc(argc, sizeof(const char *));
|
||||
for (i = 1; i < argc; i++)
|
||||
for (i = 1; i < argc; i++) {
|
||||
const char *glob;
|
||||
pattern[i - 1] = xstrfmt("*/%s", argv[i]);
|
||||
|
||||
glob = strchr(argv[i], '*');
|
||||
if (glob)
|
||||
argv_array_pushf(&ref_prefixes, "%.*s",
|
||||
(int)(glob - argv[i]), argv[i]);
|
||||
else
|
||||
expand_ref_prefix(&ref_prefixes, argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
remote = remote_get(dest);
|
||||
@ -97,7 +108,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
|
||||
if (uploadpack != NULL)
|
||||
transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack);
|
||||
|
||||
ref = transport_get_remote_refs(transport);
|
||||
ref = transport_get_remote_refs(transport, &ref_prefixes);
|
||||
if (transport_disconnect(transport))
|
||||
return 1;
|
||||
|
||||
|
Reference in New Issue
Block a user