summaryrefslogtreecommitdiff
path: root/test-wildmatch.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-11-20 08:02:39 +0100
committerJunio C Hamano <gitster@pobox.com>2012-11-20 12:09:13 -0800
commitef49841ddf98ed1eb40c60153072fa1a91fc2f18 (patch)
tree24affb2a4be0fd5d822d68be9d5c26ad145a27ac /test-wildmatch.c
parent237ec6e40d4fd1a0190c4ffde6d18278abc5853a (diff)
downloadgit-ef49841ddf98ed1eb40c60153072fa1a91fc2f18.tar.gz
test-wildmatch: avoid Windows path mangling
The MSYS bash mangles arguments that begin with a forward slash when they are passed to test-wildmatch. This causes tests to fail. Avoid mangling by prepending "XXX", which is removed by test-wildmatch before further processing. [J6t: reworded commit message] Reported-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Diffstat (limited to 'test-wildmatch.c')
-rw-r--r--test-wildmatch.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test-wildmatch.c b/test-wildmatch.c
index 74c08644ee..e384c8edb1 100644
--- a/test-wildmatch.c
+++ b/test-wildmatch.c
@@ -3,6 +3,14 @@
int main(int argc, char **argv)
{
+ int i;
+ for (i = 2; i < argc; i++) {
+ if (argv[i][0] == '/')
+ die("Forward slash is not allowed at the beginning of the\n"
+ "pattern because Windows does not like it. Use `XXX/' instead.");
+ else if (!strncmp(argv[i], "XXX/", 4))
+ argv[i] += 3;
+ }
if (!strcmp(argv[1], "wildmatch"))
return !!wildmatch(argv[3], argv[2], 0);
else if (!strcmp(argv[1], "iwildmatch"))