t1508: Be more clever than msys path substitution

A string of the form "@/abcd" is considered a file path
by the msys layer and therefore translated to a windows path.

Here the trick is to double the slashes.

The msys patch translation can be studied with the following
test program:

 #include <stdio.h>
 #include <stdlib.h>

 int main(int argc, char** argv)
 {
 unsigned int i;
 for(i=1; i < argc; i++)
 	printf("argv[%d]=%s\n",i, argv[i]);

 exit(0);
 }

Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
This commit is contained in:
Thomas Braun
2014-09-24 21:06:25 +02:00
committed by Johannes Schindelin
parent f5d3197780
commit 11634d31c5

View File

@@ -29,13 +29,22 @@ fail() {
"$@" failure
}
if test_have_prereq MINGW
then
# MSys interprets `@/abc` to be a file list, and wants to substitute
# the Unix-y path with a Windows one (e.g. @C:\msys64\abc)
AT_SLASH=@//at-test
else
AT_SLASH=@/at-test
fi
test_expect_success 'setup' '
test_commit master-one &&
test_commit master-two &&
git checkout -b upstream-branch &&
test_commit upstream-one &&
test_commit upstream-two &&
git checkout -b @/at-test &&
git checkout -b $AT_SLASH &&
git checkout -b @@/at-test &&
git checkout -b @at-test &&
git checkout -b old-branch &&
@@ -64,7 +73,7 @@ check "@{-1}@{u}@{1}" commit master-one
check "@" commit new-two
check "@@{u}" ref refs/heads/upstream-branch
check "@@/at-test" ref refs/heads/@@/at-test
check "@/at-test" ref refs/heads/@/at-test
check "$AT_SLASH" ref refs/heads/@/at-test
check "@at-test" ref refs/heads/@at-test
nonsense "@{u}@{-1}"
nonsense "@{0}@{0}"