]>
Commit | Line | Data |
---|---|---|
b7ce24d0 | 1 | #include "test-tool.h" |
ed10cb95 | 2 | #include "cache.h" |
ed10cb95 BW |
3 | #include "parse-options.h" |
4 | #include "serve.h" | |
5 | ||
6 | static char const * const serve_usage[] = { | |
b7ce24d0 | 7 | N_("test-tool serve-v2 [<options>]"), |
ed10cb95 BW |
8 | NULL |
9 | }; | |
10 | ||
b7ce24d0 | 11 | int cmd__serve_v2(int argc, const char **argv) |
ed10cb95 | 12 | { |
f234da80 ÆAB |
13 | int stateless_rpc = 0; |
14 | int advertise_capabilities = 0; | |
ed10cb95 | 15 | struct option options[] = { |
f234da80 | 16 | OPT_BOOL(0, "stateless-rpc", &stateless_rpc, |
ed10cb95 | 17 | N_("quit after a single request/response exchange")), |
f234da80 | 18 | OPT_BOOL(0, "advertise-capabilities", &advertise_capabilities, |
ed10cb95 BW |
19 | N_("exit immediately after advertising capabilities")), |
20 | OPT_END() | |
21 | }; | |
b7ce24d0 | 22 | const char *prefix = setup_git_directory(); |
ed10cb95 BW |
23 | |
24 | /* ignore all unknown cmdline switches for now */ | |
25 | argc = parse_options(argc, argv, prefix, options, serve_usage, | |
26 | PARSE_OPT_KEEP_DASHDASH | | |
99d86d60 | 27 | PARSE_OPT_KEEP_UNKNOWN_OPT); |
f234da80 ÆAB |
28 | |
29 | if (advertise_capabilities) | |
30 | protocol_v2_advertise_capabilities(); | |
31 | else | |
32 | protocol_v2_serve_loop(stateless_rpc); | |
ed10cb95 BW |
33 | |
34 | return 0; | |
35 | } |