2018-03-24 10:44:30 +03:00
|
|
|
#include "git-compat-util.h"
|
|
|
|
#include "test-tool.h"
|
|
|
|
|
|
|
|
struct test_cmd {
|
|
|
|
const char *name;
|
|
|
|
int (*fn)(int argc, const char **argv);
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct test_cmd cmds[] = {
|
2018-03-24 10:44:31 +03:00
|
|
|
{ "chmtime", cmd__chmtime },
|
2018-03-24 10:44:32 +03:00
|
|
|
{ "sha1", cmd__sha1 },
|
2018-03-24 10:44:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
int cmd_main(int argc, const char **argv)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (argc < 2)
|
|
|
|
die("I need a test name!");
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
|
|
|
if (!strcmp(cmds[i].name, argv[1])) {
|
|
|
|
argv++;
|
|
|
|
argc--;
|
|
|
|
return cmds[i].fn(argc, argv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
die("There is no test named '%s'", argv[1]);
|
|
|
|
}
|