The seventh batch
[alt-git.git] / t / helper / test-serve-v2.c
blob054cbcf5d83946b225774dc9da6b0ec1d112e79d
1 #include "test-tool.h"
2 #include "gettext.h"
3 #include "parse-options.h"
4 #include "serve.h"
5 #include "setup.h"
7 static char const * const serve_usage[] = {
8 N_("test-tool serve-v2 [<options>]"),
9 NULL
12 int cmd__serve_v2(int argc, const char **argv)
14 int stateless_rpc = 0;
15 int advertise_capabilities = 0;
16 struct option options[] = {
17 OPT_BOOL(0, "stateless-rpc", &stateless_rpc,
18 N_("quit after a single request/response exchange")),
19 OPT_BOOL(0, "advertise-capabilities", &advertise_capabilities,
20 N_("exit immediately after advertising capabilities")),
21 OPT_END()
23 const char *prefix = setup_git_directory();
25 /* ignore all unknown cmdline switches for now */
26 argc = parse_options(argc, argv, prefix, options, serve_usage,
27 PARSE_OPT_KEEP_DASHDASH |
28 PARSE_OPT_KEEP_UNKNOWN_OPT);
30 if (advertise_capabilities)
31 protocol_v2_advertise_capabilities();
32 else
33 protocol_v2_serve_loop(stateless_rpc);
35 return 0;