{"thread":{"id":"44760","subject":"[PATCH] mingw: add a regression test for pushing to UNC paths","startedAt":"2016-12-23T17:11:52Z","lastAt":"2017-01-02T10:40:35Z","messageCount":4,"participants":["Johannes Schindelin","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"308302","messageId":"9fb8a9f405b19db087379ea5bbad80c3fbac8e4e.1482513055.git.johannes.schindelin@gmx.de","threadId":"44760","inReplyTo":null,"subject":"[PATCH] mingw: add a regression test for pushing to UNC paths","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-12-23T17:11:33Z","receivedAt":"2016-12-23T17:11:52Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"On Windows, there are \"UNC paths\" to access network (AKA shared)\nfolders, of the form \\\\server\\sharename\\directory. This provides a\nconvenient way for Windows developers to share their Git repositories\nwithout having to have a dedicated server.\n\nGit for Windows v2.11.0 introduced a regression where pushing to said\nUNC paths no longer works, although fetching and cloning still does, as\nreported here: https://github.com/git-for-windows/git/issues/979\n\nThis regression was fixed in 7814fbe3f1 (normalize_path_copy(): fix\npushing to //server/share/dir on Windows, 2016-12-14).\n\nLet's make sure that it does not regress again, by introducing a test\nthat uses so-called \"administrative shares\": disk volumes are\nautomatically shared under certain circumstances, e.g.  the C: drive is\nshared as \\\\localhost\\c$. The test needs to be skipped if the current\ndirectory is inaccessible via said administrative share, of course.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\nPublished-As: https://github.com/dscho/git/releases/tag/unc-paths-test-v1\nFetch-It-Via: git fetch https://github.com/dscho/git unc-paths-test-v1\n\n t/t5580-clone-push-unc.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 46 insertions(+)\n create mode 100755 t/t5580-clone-push-unc.sh\n\ndiff --git a/t/t5580-clone-push-unc.sh b/t/t5580-clone-push-unc.sh\nnew file mode 100755\nindex 0000000000..e06d230724\n--- /dev/null\n+++ b/t/t5580-clone-push-unc.sh\n@@ -0,0 +1,46 @@\n+#!/bin/sh\n+\n+test_description='various UNC path tests (Windows-only)'\n+. ./test-lib.sh\n+\n+if ! test_have_prereq MINGW; then\n+\tskip_all='skipping UNC path tests, requires Windows'\n+\ttest_done\n+fi\n+\n+UNCPATH=\"$(pwd)\"\n+case \"$UNCPATH\" in\n+[A-Z]:*)\n+\t# Use administrative share e.g. \\\\localhost\\C$\\git-sdk-64\\usr\\src\\git\n+\t# (we use forward slashes here because MSYS2 and Git accept them, and\n+\t# they are easier on the eyes)\n+\tUNCPATH=\"//localhost/${UNCPATH%%:*}\\$/${UNCPATH#?:}\"\n+\ttest -d \"$UNCPATH\" || {\n+\t\tskip_all='could not access administrative share; skipping'\n+\t\ttest_done\n+\t}\n+\t;;\n+*)\n+\tskip_all='skipping UNC path tests, cannot determine current path as UNC'\n+\ttest_done\n+\t;;\n+esac\n+\n+test_expect_success setup '\n+\ttest_commit initial\n+'\n+\n+test_expect_success clone '\n+\tgit clone \"file://$UNCPATH\" clone\n+'\n+\n+test_expect_success push '\n+\t(\n+\t\tcd clone &&\n+\t\tgit checkout -b to-push &&\n+\t\ttest_commit to-push &&\n+\t\tgit push origin HEAD\n+\t)\n+'\n+\n+test_done\n\nbase-commit: 1ede815b8d1562f46b7aa5d55af084a3cad2ecf8\n-- \n2.11.0.rc3.windows.1\n"},{"id":"308305","messageId":"6d69b529-a42c-9f93-f342-7c6c19170285@kdbg.org","threadId":"44760","inReplyTo":"9fb8a9f405b19db087379ea5bbad80c3fbac8e4e.1482513055.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH] mingw: add a regression test for pushing to UNC paths","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-12-23T18:04:45Z","receivedAt":"2016-12-23T18:04:54Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 23.12.2016 um 18:11 schrieb Johannes Schindelin:\n> Let's make sure that it does not regress again, by introducing a test\n> that uses so-called \"administrative shares\": disk volumes are\n> automatically shared under certain circumstances, e.g.  the C: drive is\n> shared as \\\\localhost\\c$.\n\nClever!\n\n> +test_expect_success setup '\n> +\ttest_commit initial\n> +'\n> +\n> +test_expect_success clone '\n> +\tgit clone \"file://$UNCPATH\" clone\n> +'\n> +\n> +test_expect_success push '\n> +\t(\n> +\t\tcd clone &&\n> +\t\tgit checkout -b to-push &&\n> +\t\ttest_commit to-push &&\n> +\t\tgit push origin HEAD\n> +\t)\n> +'\n> +\n> +test_done\n\nWouldn't at a minimum\n\ntest_expect_success 'check push result' '\n\tgit rev-parse to-push\n'\n\nbe a good idea to make sure that the pushed commit actually arrived?\n\n-- Hannes\n\n"},{"id":"308611","messageId":"alpine.DEB.2.20.1701021121041.3469@virtualbox","threadId":"44760","inReplyTo":"6d69b529-a42c-9f93-f342-7c6c19170285@kdbg.org","subject":"Re: [PATCH] mingw: add a regression test for pushing to UNC paths","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-01-02T10:39:46Z","receivedAt":"2017-01-02T10:40:04Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Hannes,\n\nOn Fri, 23 Dec 2016, Johannes Sixt wrote:\n\n> Am 23.12.2016 um 18:11 schrieb Johannes Schindelin:\n> \n> > +test_expect_success setup '\n> > +\ttest_commit initial\n> > +'\n> > +\n> > +test_expect_success clone '\n> > +\tgit clone \"file://$UNCPATH\" clone\n> > +'\n> > +\n> > +test_expect_success push '\n> > +\t(\n> > +\t\tcd clone &&\n> > +\t\tgit checkout -b to-push &&\n> > +\t\ttest_commit to-push &&\n> > +\t\tgit push origin HEAD\n> > +\t)\n> > +'\n> > +\n> > +test_done\n> \n> Wouldn't at a minimum\n> \n> test_expect_success 'check push result' '\n> \tgit rev-parse to-push\n> '\n> \n> be a good idea to make sure that the pushed commit actually arrived?\n\nSure.\n\nCiao,\nDscho\n"},{"id":"308612","messageId":"9f1d1286b7993cc3bd93a8358c041ef4de001e91.1483353603.git.johannes.schindelin@gmx.de","threadId":"44760","inReplyTo":"9fb8a9f405b19db087379ea5bbad80c3fbac8e4e.1482513055.git.johannes.schindelin@gmx.de","subject":"[PATCH v2] mingw: add a regression test for pushing to UNC paths","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-01-02T10:40:20Z","receivedAt":"2017-01-02T10:40:35Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"On Windows, there are \"UNC paths\" to access network (AKA shared)\nfolders, of the form \\\\server\\sharename\\directory. This provides a\nconvenient way for Windows developers to share their Git repositories\nwithout having to have a dedicated server.\n\nGit for Windows v2.11.0 introduced a regression where pushing to said\nUNC paths no longer works, although fetching and cloning still does, as\nreported here: https://github.com/git-for-windows/git/issues/979\n\nThis regression was fixed in 7814fbe3f1 (normalize_path_copy(): fix\npushing to //server/share/dir on Windows, 2016-12-14).\n\nLet's make sure that it does not regress again, by introducing a test\nthat uses so-called \"administrative shares\": disk volumes are\nautomatically shared under certain circumstances, e.g.  the C: drive is\nshared as \\\\localhost\\c$. The test needs to be skipped if the current\ndirectory is inaccessible via said administrative share, of course.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\nPublished-As: https://github.com/dscho/git/releases/tag/unc-paths-test-v2\nFetch-It-Via: git fetch https://github.com/dscho/git unc-paths-test-v2\nInterdiff vs v1:\n\n diff --git a/t/t5580-clone-push-unc.sh b/t/t5580-clone-push-unc.sh\n index e06d230724..b195f71ea9 100755\n --- a/t/t5580-clone-push-unc.sh\n +++ b/t/t5580-clone-push-unc.sh\n @@ -40,7 +40,9 @@ test_expect_success push '\n  \t\tgit checkout -b to-push &&\n  \t\ttest_commit to-push &&\n  \t\tgit push origin HEAD\n -\t)\n +\t) &&\n +\trev=\"$(git -C clone rev-parse --verify refs/heads/to-push)\" &&\n +\ttest \"$rev\" = \"$(git rev-parse --verify refs/heads/to-push)\"\n  '\n  \n  test_done\n\n\n t/t5580-clone-push-unc.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 48 insertions(+)\n create mode 100755 t/t5580-clone-push-unc.sh\n\ndiff --git a/t/t5580-clone-push-unc.sh b/t/t5580-clone-push-unc.sh\nnew file mode 100755\nindex 0000000000..b195f71ea9\n--- /dev/null\n+++ b/t/t5580-clone-push-unc.sh\n@@ -0,0 +1,48 @@\n+#!/bin/sh\n+\n+test_description='various UNC path tests (Windows-only)'\n+. ./test-lib.sh\n+\n+if ! test_have_prereq MINGW; then\n+\tskip_all='skipping UNC path tests, requires Windows'\n+\ttest_done\n+fi\n+\n+UNCPATH=\"$(pwd)\"\n+case \"$UNCPATH\" in\n+[A-Z]:*)\n+\t# Use administrative share e.g. \\\\localhost\\C$\\git-sdk-64\\usr\\src\\git\n+\t# (we use forward slashes here because MSYS2 and Git accept them, and\n+\t# they are easier on the eyes)\n+\tUNCPATH=\"//localhost/${UNCPATH%%:*}\\$/${UNCPATH#?:}\"\n+\ttest -d \"$UNCPATH\" || {\n+\t\tskip_all='could not access administrative share; skipping'\n+\t\ttest_done\n+\t}\n+\t;;\n+*)\n+\tskip_all='skipping UNC path tests, cannot determine current path as UNC'\n+\ttest_done\n+\t;;\n+esac\n+\n+test_expect_success setup '\n+\ttest_commit initial\n+'\n+\n+test_expect_success clone '\n+\tgit clone \"file://$UNCPATH\" clone\n+'\n+\n+test_expect_success push '\n+\t(\n+\t\tcd clone &&\n+\t\tgit checkout -b to-push &&\n+\t\ttest_commit to-push &&\n+\t\tgit push origin HEAD\n+\t) &&\n+\trev=\"$(git -C clone rev-parse --verify refs/heads/to-push)\" &&\n+\ttest \"$rev\" = \"$(git rev-parse --verify refs/heads/to-push)\"\n+'\n+\n+test_done\n\nbase-commit: c69c2f50cfc0dcd4bcd014c7fd56e344a7c5522f\n-- \n2.11.0.rc3.windows.1\n"}]}