| 286 | } |
| 287 | |
| 288 | static 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 |
| 312 | static int child_notifier = -1; |
no test coverage detected