Skip to content

Commit 44b4124

Browse files
t-bdscho
authored andcommitted
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 <[email protected]>
1 parent ad350e2 commit 44b4124

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

t/t1508-at-combinations.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,22 @@ fail() {
2929
"$@" failure
3030
}
3131

32+
if test_have_prereq MINGW
33+
then
34+
# MSys interprets `@/abc` to be a file list, and wants to substitute
35+
# the Unix-y path with a Windows one (e.g. @C:\msys64\abc)
36+
AT_SLASH=@//at-test
37+
else
38+
AT_SLASH=@/at-test
39+
fi
40+
3241
test_expect_success 'setup' '
3342
test_commit master-one &&
3443
test_commit master-two &&
3544
git checkout -b upstream-branch &&
3645
test_commit upstream-one &&
3746
test_commit upstream-two &&
38-
git checkout -b @/at-test &&
47+
git checkout -b $AT_SLASH &&
3948
git checkout -b @@/at-test &&
4049
git checkout -b @at-test &&
4150
git checkout -b old-branch &&
@@ -64,7 +73,7 @@ check "@{-1}@{u}@{1}" commit master-one
6473
check "@" commit new-two
6574
check "@@{u}" ref refs/heads/upstream-branch
6675
check "@@/at-test" ref refs/heads/@@/at-test
67-
check "@/at-test" ref refs/heads/@/at-test
76+
check "$AT_SLASH" ref refs/heads/@/at-test
6877
check "@at-test" ref refs/heads/@at-test
6978
nonsense "@{u}@{-1}"
7079
nonsense "@{0}@{0}"

0 commit comments

Comments
 (0)