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

Function quote_cmdline

alias.c:100–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void quote_cmdline(struct strbuf *buf, const char **argv)
101{
102 for (const char **argp = argv; *argp; argp++) {
103 if (argp != argv)
104 strbuf_addch(buf, ' ');
105 strbuf_addch(buf, '"');
106 for (const char *p = *argp; *p; p++) {
107 const char c = *p;
108
109 if (c == '"' || c =='\\')
110 strbuf_addch(buf, '\\');
111 strbuf_addch(buf, c);
112 }
113 strbuf_addch(buf, '"');
114 }
115}
116
117#define SPLIT_CMDLINE_BAD_ENDING 1
118#define SPLIT_CMDLINE_UNCLOSED_QUOTE 2

Callers 1

write_strategy_optsFunction · 0.85

Calls 1

strbuf_addchFunction · 0.85

Tested by

no test coverage detected