Skip to content

Commit

Permalink
mingw: demonstrate a regression pushing to UNC paths
Browse files Browse the repository at this point in the history
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 <johannes.schindelin@gmx.de>
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Jan 18, 2017
1 parent 7895078 commit 523585e
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions t/t5580-clone-push-unc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

test_description='various UNC path tests (Windows-only)'
. ./test-lib.sh

if ! test_have_prereq MINGW; then
skip_all='skipping UNC path tests, requires Windows'
test_done
fi

UNCPATH="$(pwd)"
case "$UNCPATH" in
[A-Z]:*)
# Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git
# (we use forward slashes here because MSYS2 and Git accept them, and
# they are easier on the eyes)
UNCPATH="//localhost/${UNCPATH%%:*}\$/${UNCPATH#?:}"
test -d "$UNCPATH" || {
skip_all='could not access administrative share; skipping'
test_done
}
;;
*)
skip_all='skipping UNC path tests, cannot determine current path as UNC'
test_done
;;
esac

test_expect_success setup '
test_commit initial
'

test_expect_success clone '
git clone "file://$UNCPATH" clone
'

test_expect_failure push '
(
cd clone &&
git checkout -b to-push &&
test_commit to-push &&
git push origin HEAD
)
'

test_done

0 comments on commit 523585e

Please sign in to comment.