]> git.ipfire.org Git - thirdparty/git.git/blame - t/helper/test-subprocess.c
Merge branch 'jk/ci-retire-allow-ref'
[thirdparty/git.git] / t / helper / test-subprocess.c
CommitLineData
112edd6a 1#include "test-tool.h"
0ed74813 2#include "run-command.h"
e38da487 3#include "setup.h"
0ed74813 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;
6def0ff8 18 strvec_pushv(&cp.args, (const char **)argv + 1);
0ed74813
NTND
19 return run_command(&cp);
20}