]> git.ipfire.org Git - thirdparty/git.git/blame - t/helper/test-subprocess.c
git-cli.txt: clarify "options first and then args"
[thirdparty/git.git] / t / helper / test-subprocess.c
CommitLineData
112edd6a 1#include "test-tool.h"
0ed74813
NTND
2#include "cache.h"
3#include "run-command.h"
4
112edd6a 5int cmd__subprocess(int argc, const char **argv)
0ed74813 6{
d3180279 7 struct child_process cp = CHILD_PROCESS_INIT;
0ed74813
NTND
8 int nogit = 0;
9
c0aa335c 10 setup_git_directory_gently(&nogit);
0ed74813
NTND
11 if (nogit)
12 die("No git repo found");
a961d1f1 13 if (argc > 1 && !strcmp(argv[1], "--setup-work-tree")) {
0ed74813
NTND
14 setup_work_tree();
15 argv++;
16 }
0ed74813 17 cp.git_cmd = 1;
84d32bf7 18 cp.argv = (const char **)argv + 1;
0ed74813
NTND
19 return run_command(&cp);
20}