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