Git 2.38
[alt-git.git] / t / helper / test-parse-pathspec-file.c
blobb3e08cef4b3f86ba95509f1d66345f7ca6016ea3
1 #include "test-tool.h"
2 #include "parse-options.h"
3 #include "pathspec.h"
4 #include "gettext.h"
6 int cmd__parse_pathspec_file(int argc, const char **argv)
8 struct pathspec pathspec;
9 const char *pathspec_from_file = NULL;
10 int pathspec_file_nul = 0, i;
12 static const char *const usage[] = {
13 "test-tool parse-pathspec-file --pathspec-from-file [--pathspec-file-nul]",
14 NULL
17 struct option options[] = {
18 OPT_PATHSPEC_FROM_FILE(&pathspec_from_file),
19 OPT_PATHSPEC_FILE_NUL(&pathspec_file_nul),
20 OPT_END()
23 parse_options(argc, argv, NULL, options, usage, 0);
25 parse_pathspec_file(&pathspec, 0, 0, NULL, pathspec_from_file,
26 pathspec_file_nul);
28 for (i = 0; i < pathspec.nr; i++)
29 printf("%s\n", pathspec.items[i].original);
31 clear_pathspec(&pathspec);
32 return 0;