@@ -9,6 +9,21 @@ test -z "$NO_UNIX_SOCKETS" || {
9
9
test_done
10
10
}
11
11
12
+ uname_s=$( uname -s)
13
+ case $uname_s in
14
+ * MINGW* )
15
+ test_path_is_socket () {
16
+ # `test -S` cannot detect Win10's Unix sockets
17
+ test_path_exists " $1 "
18
+ }
19
+ ;;
20
+ * )
21
+ test_path_is_socket () {
22
+ test -S " $1 "
23
+ }
24
+ ;;
25
+ esac
26
+
12
27
# don't leave a stale daemon running
13
28
test_atexit ' git credential-cache exit'
14
29
@@ -21,7 +36,7 @@ test_expect_success 'socket defaults to ~/.cache/git/credential/socket' '
21
36
rmdir -p .cache/git/credential/
22
37
" &&
23
38
test_path_is_missing "$HOME/.git-credential-cache" &&
24
- test -S "$HOME/.cache/git/credential/socket"
39
+ test_path_is_socket "$HOME/.cache/git/credential/socket"
25
40
'
26
41
27
42
XDG_CACHE_HOME=" $HOME /xdg"
@@ -31,7 +46,7 @@ helper_test cache
31
46
32
47
test_expect_success " use custom XDG_CACHE_HOME if set and default sockets are not created" '
33
48
test_when_finished "git credential-cache exit" &&
34
- test -S "$XDG_CACHE_HOME/git/credential/socket" &&
49
+ test_path_is_socket "$XDG_CACHE_HOME/git/credential/socket" &&
35
50
test_path_is_missing "$HOME/.git-credential-cache/socket" &&
36
51
test_path_is_missing "$HOME/.cache/git/credential/socket"
37
52
'
@@ -48,7 +63,7 @@ test_expect_success 'credential-cache --socket option overrides default location
48
63
username=store-user
49
64
password=store-pass
50
65
EOF
51
- test -S "$HOME/dir/socket"
66
+ test_path_is_socket "$HOME/dir/socket"
52
67
'
53
68
54
69
test_expect_success " use custom XDG_CACHE_HOME even if xdg socket exists" '
@@ -62,7 +77,7 @@ test_expect_success "use custom XDG_CACHE_HOME even if xdg socket exists" '
62
77
username=store-user
63
78
password=store-pass
64
79
EOF
65
- test -S "$HOME/.cache/git/credential/socket" &&
80
+ test_path_is_socket "$HOME/.cache/git/credential/socket" &&
66
81
XDG_CACHE_HOME="$HOME/xdg" &&
67
82
export XDG_CACHE_HOME &&
68
83
check approve cache <<-\EOF &&
@@ -71,22 +86,23 @@ test_expect_success "use custom XDG_CACHE_HOME even if xdg socket exists" '
71
86
username=store-user
72
87
password=store-pass
73
88
EOF
74
- test -S "$XDG_CACHE_HOME/git/credential/socket"
89
+ test_path_is_socket "$XDG_CACHE_HOME/git/credential/socket"
75
90
'
76
91
77
92
test_expect_success ' use user socket if user directory exists' '
78
93
test_when_finished "
79
94
git credential-cache exit &&
80
95
rmdir \"\$HOME/.git-credential-cache/\"
81
96
" &&
82
- mkdir -p -m 700 "$HOME/.git-credential-cache/" &&
97
+ mkdir -p "$HOME/.git-credential-cache/" &&
98
+ chmod 700 "$HOME/.git-credential-cache/" &&
83
99
check approve cache <<-\EOF &&
84
100
protocol=https
85
101
host=example.com
86
102
username=store-user
87
103
password=store-pass
88
104
EOF
89
- test -S "$HOME/.git-credential-cache/socket"
105
+ test_path_is_socket "$HOME/.git-credential-cache/socket"
90
106
'
91
107
92
108
test_expect_success SYMLINKS ' use user socket if user directory is a symlink to a directory' '
@@ -103,7 +119,7 @@ test_expect_success SYMLINKS 'use user socket if user directory is a symlink to
103
119
username=store-user
104
120
password=store-pass
105
121
EOF
106
- test -S "$HOME/.git-credential-cache/socket"
122
+ test_path_is_socket "$HOME/.git-credential-cache/socket"
107
123
'
108
124
109
125
helper_test_timeout cache --timeout=1
0 commit comments