summaryrefslogtreecommitdiff
path: root/test-wildmatch.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-11-20 07:02:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-11-20 20:09:13 (GMT)
commitef49841ddf98ed1eb40c60153072fa1a91fc2f18 (patch)
tree24affb2a4be0fd5d822d68be9d5c26ad145a27ac /test-wildmatch.c
parent237ec6e40d4fd1a0190c4ffde6d18278abc5853a (diff)
downloadgit-ef49841ddf98ed1eb40c60153072fa1a91fc2f18.zip
git-ef49841ddf98ed1eb40c60153072fa1a91fc2f18.tar.gz
git-ef49841ddf98ed1eb40c60153072fa1a91fc2f18.tar.bz2
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 74c0864..e384c8e 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"))