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

Function prepare_shell_cmd

run-command.c:288–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288static const char **prepare_shell_cmd(struct strvec *out, const char **argv)
289{
290 if (!argv[0])
291 BUG("shell command is empty");
292
293 if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
294 strvec_push_nodup(out, git_shell_path());
295 strvec_push(out, "-c");
296
297 /*
298 * If we have no extra arguments, we do not even need to
299 * bother with the "$@" magic.
300 */
301 if (!argv[1])
302 strvec_push(out, argv[0]);
303 else
304 strvec_pushf(out, "%s \"$@\"", argv[0]);
305 }
306
307 strvec_pushv(out, argv);
308 return out->v;
309}
310
311#ifndef GIT_WINDOWS_NATIVE
312static int child_notifier = -1;

Callers 2

prepare_cmdFunction · 0.85
start_commandFunction · 0.85

Calls 5

strvec_push_nodupFunction · 0.85
git_shell_pathFunction · 0.85
strvec_pushFunction · 0.85
strvec_pushfFunction · 0.85
strvec_pushvFunction · 0.85

Tested by

no test coverage detected