File tree 2 files changed +25
-8
lines changed
2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -948,12 +948,20 @@ unsigned int sleep (unsigned int seconds)
948
948
char * mingw_mktemp (char * template )
949
949
{
950
950
wchar_t wtemplate [MAX_PATH ];
951
+ int offset = 0 ;
952
+
951
953
/* we need to return the path, thus no long paths here! */
952
954
if (xutftowcs_path (wtemplate , template ) < 0 )
953
955
return NULL ;
956
+
957
+ if (is_dir_sep (template [0 ]) && !is_dir_sep (template [1 ]) &&
958
+ iswalpha (wtemplate [0 ]) && wtemplate [1 ] == L':' ) {
959
+ /* We have an absolute path missing the drive prefix */
960
+ offset = 2 ;
961
+ }
954
962
if (!_wmktemp (wtemplate ))
955
963
return NULL ;
956
- if (xwcstoutf (template , wtemplate , strlen (template ) + 1 ) < 0 )
964
+ if (xwcstoutf (template , wtemplate + offset , strlen (template ) + 1 ) < 0 )
957
965
return NULL ;
958
966
return template ;
959
967
}
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
- test_description=' various UNC path tests (Windows-only) '
3
+ test_description=' various Windows path tests'
4
4
. ./test-lib.sh
5
5
6
6
if ! test_have_prereq MINGW; then
7
- skip_all=' skipping UNC path tests, requires Windows '
7
+ skip_all=' skipping Windows-specific path tests'
8
8
test_done
9
9
fi
10
10
11
11
UNCPATH=" $( pwd) "
12
12
case " $UNCPATH " in
13
13
[A-Z]:* )
14
+ WITHOUTDRIVE=" ${UNCPATH# ?: } "
14
15
# Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git
15
16
# (we use forward slashes here because MSYS2 and Git accept them, and
16
17
# they are easier on the eyes)
17
- UNCPATH=" //localhost/${UNCPATH%%:* } \$ /${UNCPATH# ?: } "
18
- test -d " $UNCPATH " || {
19
- skip_all=' could not access administrative share; skipping'
20
- test_done
21
- }
18
+ UNCPATH=" //localhost/${UNCPATH%%:* } \$ $WITHOUTDRIVE "
22
19
;;
23
20
* )
24
21
skip_all=' skipping UNC path tests, cannot determine current path as UNC'
25
22
test_done
26
23
;;
27
24
esac
28
25
26
+ test_expect_success ' clone into absolute path lacking a drive prefix' '
27
+ USINGBACKSLASHES="$(echo "$WITHOUTDRIVE"/without-drive-prefix |
28
+ tr / \\)" &&
29
+ git clone . "$USINGBACKSLASHES" &&
30
+ test -f without-drive-prefix/.git/HEAD
31
+ '
32
+
33
+ test -d " $UNCPATH " || {
34
+ skip_all=' could not access administrative share; skipping'
35
+ test_done
36
+ }
37
+
29
38
test_expect_success setup '
30
39
test_commit initial
31
40
'
You can’t perform that action at this time.
0 commit comments