MCPcopy Create free account
hub / github.com/git/git / parse_arg

Function parse_arg

builtin/update-ref.c:43–58  ·  view source on GitHub ↗

* Parse one whitespace- or NUL-terminated, possibly C-quoted argument * and append the result to arg. Return a pointer to the terminator. * Die if there is an error in how the argument is C-quoted. This * function is only used if not -z. */

Source from the content-addressed store, hash-verified

41 * function is only used if not -z.
42 */
43static const char *parse_arg(const char *next, struct strbuf *arg)
44{
45 if (*next == '"') {
46 const char *orig = next;
47
48 if (unquote_c_style(arg, next, &next))
49 die("badly quoted argument: %s", orig);
50 if (*next && !isspace(*next))
51 die("unexpected character after quoted argument: %s", orig);
52 } else {
53 while (*next && !isspace(*next))
54 strbuf_addch(arg, *next++);
55 }
56
57 return next;
58}
59
60/*
61 * Parse the reference name immediately after "command SP". If not

Callers 3

parse_refnameFunction · 0.85
parse_next_argFunction · 0.85
parse_next_oidFunction · 0.85

Calls 3

unquote_c_styleFunction · 0.85
strbuf_addchFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected