2018-03-24 07:45:02 +00:00
|
|
|
#include "test-tool.h"
|
2010-12-27 01:26:04 +00:00
|
|
|
#include "run-command.h"
|
2023-03-21 06:26:05 +00:00
|
|
|
#include "setup.h"
|
2010-12-27 01:26:04 +00:00
|
|
|
|
2018-03-24 07:45:02 +00:00
|
|
|
int cmd__subprocess(int argc, const char **argv)
|
2010-12-27 01:26:04 +00:00
|
|
|
{
|
2014-08-19 19:09:35 +00:00
|
|
|
struct child_process cp = CHILD_PROCESS_INIT;
|
2010-12-27 01:26:04 +00:00
|
|
|
int nogit = 0;
|
|
|
|
|
2011-03-22 12:50:08 +00:00
|
|
|
setup_git_directory_gently(&nogit);
|
2010-12-27 01:26:04 +00:00
|
|
|
if (nogit)
|
|
|
|
die("No git repo found");
|
2012-04-10 19:07:34 +00:00
|
|
|
if (argc > 1 && !strcmp(argv[1], "--setup-work-tree")) {
|
2010-12-27 01:26:04 +00:00
|
|
|
setup_work_tree();
|
|
|
|
argv++;
|
|
|
|
}
|
|
|
|
cp.git_cmd = 1;
|
2021-11-25 22:52:18 +00:00
|
|
|
strvec_pushv(&cp.args, (const char **)argv + 1);
|
2010-12-27 01:26:04 +00:00
|
|
|
return run_command(&cp);
|
|
|
|
}
|