| 252 | } |
| 253 | |
| 254 | static int parse_command(struct repository *r, const char *key, struct protocol_capability **command) |
| 255 | { |
| 256 | const char *out; |
| 257 | |
| 258 | if (skip_prefix(key, "command=", &out)) { |
| 259 | const char *value; |
| 260 | struct protocol_capability *cmd = get_capability(out, &value); |
| 261 | |
| 262 | if (*command) |
| 263 | die("command '%s' requested after already requesting command '%s'", |
| 264 | out, (*command)->name); |
| 265 | if (!cmd || !cmd->advertise(r, NULL) || !cmd->command || value) |
| 266 | die("invalid command '%s'", out); |
| 267 | |
| 268 | *command = cmd; |
| 269 | return 1; |
| 270 | } |
| 271 | |
| 272 | return 0; |
| 273 | } |
| 274 | |
| 275 | enum request_state { |
| 276 | PROCESS_REQUEST_KEYS, |
no test coverage detected