MCPcopy Index your code
hub / github.com/git/git / parse_extra_args

Function parse_extra_args

daemon.c:623–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621}
622
623static void parse_extra_args(struct hostinfo *hi, struct strvec *env,
624 char *extra_args, int buflen)
625{
626 const char *end = extra_args + buflen;
627 struct strbuf git_protocol = STRBUF_INIT;
628
629 /* First look for the host argument */
630 extra_args = parse_host_arg(hi, extra_args, buflen);
631
632 /* Look for additional arguments places after a second NUL byte */
633 for (; extra_args < end; extra_args += strlen(extra_args) + 1) {
634 const char *arg = extra_args;
635
636 /*
637 * Parse the extra arguments, adding most to 'git_protocol'
638 * which will be used to set the 'GIT_PROTOCOL' envvar in the
639 * service that will be run.
640 *
641 * If there ends up being a particular arg in the future that
642 * git-daemon needs to parse specifically (like the 'host' arg)
643 * then it can be parsed here and not added to 'git_protocol'.
644 */
645 if (*arg) {
646 if (git_protocol.len > 0)
647 strbuf_addch(&git_protocol, ':');
648 strbuf_addstr(&git_protocol, arg);
649 }
650 }
651
652 if (git_protocol.len > 0) {
653 loginfo("Extended attribute \"protocol\": %s", git_protocol.buf);
654 strvec_pushf(env, GIT_PROTOCOL_ENVIRONMENT "=%s",
655 git_protocol.buf);
656 }
657 strbuf_release(&git_protocol);
658}
659
660/*
661 * Locate canonical hostname and its IP address.

Callers 1

executeFunction · 0.85

Calls 6

parse_host_argFunction · 0.85
strbuf_addchFunction · 0.85
strbuf_addstrFunction · 0.85
loginfoFunction · 0.85
strvec_pushfFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected