Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit e8d0887

Browse files
kbleesgitster
authored andcommitted
t800[12]: work around MSys limitation
MSys works very hard to convert Unix-style paths into DOS-style ones. *Very* hard. So hard, indeed, that git blame -L/hello/,/green/ is translated into something like git blame -LC:/msysgit/hello/,C:/msysgit/green/ As seen in msys_p2w in src\msys\msys\rt\src\winsup\cygwin\path.cc, line 3204ff: case '-': // // here we check for POSIX paths as attributes to a POSIX switch. // ... seemingly absolute POSIX paths in single-letter options get expanded by msys.dll unless they contain '=' or ';'. So a quick and very dirty fix is to use '-L/;*evil/'. (Using an equal sign works only when it is before a comma, so in the above example, /=*green/ would still be converted to a DOS-style path.) The -L mangling can be done by the script, just before the parameter is passed to the executable. This version does not modify the body of the tests and is active on MinGW only. Commit-message-by: Johannes Schindelin <[email protected]> Author: Stepan Kasal <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Stepan Kasal <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 44cf1c0 commit e8d0887

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

t/annotate-tests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# This file isn't used as a test script directly, instead it is
22
# sourced from t8001-annotate.sh and t8002-blame.sh.
33

4+
if test_have_prereq MINGW
5+
then
6+
sanitize_L () {
7+
echo "$1" | sed 'sX\(^-L\|,\)\^\?/X&\\;*Xg'
8+
}
9+
else
10+
sanitize_L () {
11+
echo "$1"
12+
}
13+
fi
14+
415
check_count () {
516
head= &&
617
file='file' &&
@@ -10,6 +21,7 @@ check_count () {
1021
case "$1" in
1122
-h) head="$2"; shift; shift ;;
1223
-f) file="$2"; shift; shift ;;
24+
-L*) options="$options $(sanitize_L "$1")"; shift ;;
1325
-*) options="$options $1"; shift ;;
1426
*) break ;;
1527
esac

0 commit comments

Comments
 (0)