Merge branch 'rs/nth-switch-code-simplification'
[git] / t / helper / test-subprocess.c
1 #include "test-tool.h"
2 #include "cache.h"
3 #include "run-command.h"
4
5 int cmd__subprocess(int argc, const char **argv)
6 {
7         struct child_process cp = CHILD_PROCESS_INIT;
8         int nogit = 0;
9
10         setup_git_directory_gently(&nogit);
11         if (nogit)
12                 die("No git repo found");
13         if (argc > 1 && !strcmp(argv[1], "--setup-work-tree")) {
14                 setup_work_tree();
15                 argv++;
16         }
17         cp.git_cmd = 1;
18         cp.argv = (const char **)argv + 1;
19         return run_command(&cp);
20 }