All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mingw: add a regression test for pushing to UNC paths
@ 2016-12-23 17:11 Johannes Schindelin
  2016-12-23 18:04 ` Johannes Sixt
  2017-01-02 10:40 ` [PATCH v2] " Johannes Schindelin
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Schindelin @ 2016-12-23 17:11 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Sixt

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, as
reported here: https://github.com/git-for-windows/git/issues/979

This regression was fixed in 7814fbe3f1 (normalize_path_copy(): fix
pushing to //server/share/dir on Windows, 2016-12-14).

Let's make sure that it does not regress again, by introducing a test
that uses 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.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Published-As: https://github.com/dscho/git/releases/tag/unc-paths-test-v1
Fetch-It-Via: git fetch https://github.com/dscho/git unc-paths-test-v1

 t/t5580-clone-push-unc.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100755 t/t5580-clone-push-unc.sh

diff --git a/t/t5580-clone-push-unc.sh b/t/t5580-clone-push-unc.sh
new file mode 100755
index 0000000000..e06d230724
--- /dev/null
+++ b/t/t5580-clone-push-unc.sh
@@ -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_success push '
+	(
+		cd clone &&
+		git checkout -b to-push &&
+		test_commit to-push &&
+		git push origin HEAD
+	)
+'
+
+test_done

base-commit: 1ede815b8d1562f46b7aa5d55af084a3cad2ecf8
-- 
2.11.0.rc3.windows.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mingw: add a regression test for pushing to UNC paths
  2016-12-23 17:11 [PATCH] mingw: add a regression test for pushing to UNC paths Johannes Schindelin
@ 2016-12-23 18:04 ` Johannes Sixt
  2017-01-02 10:39   ` Johannes Schindelin
  2017-01-02 10:40 ` [PATCH v2] " Johannes Schindelin
  1 sibling, 1 reply; 4+ messages in thread
From: Johannes Sixt @ 2016-12-23 18:04 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Junio C Hamano

Am 23.12.2016 um 18:11 schrieb Johannes Schindelin:
> Let's make sure that it does not regress again, by introducing a test
> that uses so-called "administrative shares": disk volumes are
> automatically shared under certain circumstances, e.g.  the C: drive is
> shared as \\localhost\c$.

Clever!

> +test_expect_success setup '
> +	test_commit initial
> +'
> +
> +test_expect_success clone '
> +	git clone "file://$UNCPATH" clone
> +'
> +
> +test_expect_success push '
> +	(
> +		cd clone &&
> +		git checkout -b to-push &&
> +		test_commit to-push &&
> +		git push origin HEAD
> +	)
> +'
> +
> +test_done

Wouldn't at a minimum

test_expect_success 'check push result' '
	git rev-parse to-push
'

be a good idea to make sure that the pushed commit actually arrived?

-- Hannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mingw: add a regression test for pushing to UNC paths
  2016-12-23 18:04 ` Johannes Sixt
@ 2017-01-02 10:39   ` Johannes Schindelin
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2017-01-02 10:39 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git, Junio C Hamano

Hi Hannes,

On Fri, 23 Dec 2016, Johannes Sixt wrote:

> Am 23.12.2016 um 18:11 schrieb Johannes Schindelin:
> 
> > +test_expect_success setup '
> > +	test_commit initial
> > +'
> > +
> > +test_expect_success clone '
> > +	git clone "file://$UNCPATH" clone
> > +'
> > +
> > +test_expect_success push '
> > +	(
> > +		cd clone &&
> > +		git checkout -b to-push &&
> > +		test_commit to-push &&
> > +		git push origin HEAD
> > +	)
> > +'
> > +
> > +test_done
> 
> Wouldn't at a minimum
> 
> test_expect_success 'check push result' '
> 	git rev-parse to-push
> '
> 
> be a good idea to make sure that the pushed commit actually arrived?

Sure.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] mingw: add a regression test for pushing to UNC paths
  2016-12-23 17:11 [PATCH] mingw: add a regression test for pushing to UNC paths Johannes Schindelin
  2016-12-23 18:04 ` Johannes Sixt
@ 2017-01-02 10:40 ` Johannes Schindelin
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2017-01-02 10:40 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Sixt

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, as
reported here: https://github.com/git-for-windows/git/issues/979

This regression was fixed in 7814fbe3f1 (normalize_path_copy(): fix
pushing to //server/share/dir on Windows, 2016-12-14).

Let's make sure that it does not regress again, by introducing a test
that uses 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.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Published-As: https://github.com/dscho/git/releases/tag/unc-paths-test-v2
Fetch-It-Via: git fetch https://github.com/dscho/git unc-paths-test-v2
Interdiff vs v1:

 diff --git a/t/t5580-clone-push-unc.sh b/t/t5580-clone-push-unc.sh
 index e06d230724..b195f71ea9 100755
 --- a/t/t5580-clone-push-unc.sh
 +++ b/t/t5580-clone-push-unc.sh
 @@ -40,7 +40,9 @@ test_expect_success push '
  		git checkout -b to-push &&
  		test_commit to-push &&
  		git push origin HEAD
 -	)
 +	) &&
 +	rev="$(git -C clone rev-parse --verify refs/heads/to-push)" &&
 +	test "$rev" = "$(git rev-parse --verify refs/heads/to-push)"
  '
  
  test_done


 t/t5580-clone-push-unc.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100755 t/t5580-clone-push-unc.sh

diff --git a/t/t5580-clone-push-unc.sh b/t/t5580-clone-push-unc.sh
new file mode 100755
index 0000000000..b195f71ea9
--- /dev/null
+++ b/t/t5580-clone-push-unc.sh
@@ -0,0 +1,48 @@
+#!/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_success push '
+	(
+		cd clone &&
+		git checkout -b to-push &&
+		test_commit to-push &&
+		git push origin HEAD
+	) &&
+	rev="$(git -C clone rev-parse --verify refs/heads/to-push)" &&
+	test "$rev" = "$(git rev-parse --verify refs/heads/to-push)"
+'
+
+test_done

base-commit: c69c2f50cfc0dcd4bcd014c7fd56e344a7c5522f
-- 
2.11.0.rc3.windows.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-02 10:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-23 17:11 [PATCH] mingw: add a regression test for pushing to UNC paths Johannes Schindelin
2016-12-23 18:04 ` Johannes Sixt
2017-01-02 10:39   ` Johannes Schindelin
2017-01-02 10:40 ` [PATCH v2] " Johannes Schindelin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.