Skip to content

Commit 49830ad

Browse files
committed
mingw: demonstrate a regression pushing to UNC paths
On Windows, there are "UNC paths" to access network (AKA shared) folders, of the form \\server\sharename\directory. This provides a convenient way for Windows developers to share their Git repositories without having to have a dedicated server. Git for Windows v2.11.0 introduced a regression where pushing to said UNC paths no longer works, although fetching and cloning still does. Demonstrate what is the problem, using so-called "administrative shares": disk volumes are automatically shared under certain circumstances, e.g. the C: drive is shared as \\localhost\c$. The test needs to be skipped if the current directory is inaccessible via said administrative share, of course. Original-report: #979 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 66d27de commit 49830ad

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

t/t5580-clone-push-unc.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/sh
2+
3+
test_description='various UNC path tests (Windows-only)'
4+
. ./test-lib.sh
5+
6+
if ! test_have_prereq MINGW; then
7+
skip_all='skipping UNC path tests, requires Windows'
8+
test_done
9+
fi
10+
11+
UNCPATH="$(pwd)"
12+
case "$UNCPATH" in
13+
[A-Z]:*)
14+
# Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git
15+
# (we use forward slashes here because MSYS2 and Git accept them, and
16+
# 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+
}
22+
;;
23+
*)
24+
skip_all='skipping UNC path tests, cannot determine current path as UNC'
25+
test_done
26+
;;
27+
esac
28+
29+
test_expect_success setup '
30+
test_commit initial
31+
'
32+
33+
test_expect_success clone '
34+
git clone "file://$UNCPATH" clone
35+
'
36+
37+
test_expect_failure push '
38+
(
39+
cd clone &&
40+
git checkout -b to-push &&
41+
test_commit to-push &&
42+
git push origin HEAD
43+
)
44+
'
45+
46+
test_done

0 commit comments

Comments
 (0)