]> git.ipfire.org Git - thirdparty/git.git/blame - t/helper/test-wildmatch.c
The fifth batch
[thirdparty/git.git] / t / helper / test-wildmatch.c
CommitLineData
0489289d 1#include "test-tool.h"
dd77d587 2#include "wildmatch.h"
feabcc17 3
0489289d 4int cmd__wildmatch(int argc, const char **argv)
feabcc17 5{
ef49841d
NTND
6 int i;
7 for (i = 2; i < argc; i++) {
8 if (argv[i][0] == '/')
9 die("Forward slash is not allowed at the beginning of the\n"
10 "pattern because Windows does not like it. Use `XXX/' instead.");
11 else if (!strncmp(argv[i], "XXX/", 4))
12 argv[i] += 3;
13 }
feabcc17 14 if (!strcmp(argv[1], "wildmatch"))
55d34269 15 return !!wildmatch(argv[3], argv[2], WM_PATHNAME);
feabcc17 16 else if (!strcmp(argv[1], "iwildmatch"))
55d34269 17 return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD);
c41244e7 18 else if (!strcmp(argv[1], "pathmatch"))
55d34269 19 return !!wildmatch(argv[3], argv[2], 0);
91061c44
ÆAB
20 else if (!strcmp(argv[1], "ipathmatch"))
21 return !!wildmatch(argv[3], argv[2], WM_CASEFOLD);
feabcc17
NTND
22 else
23 return 1;
24}