git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/1] mingw: support UNC as file://server/share/repo
@ 2019-08-24 22:07 Johannes Schindelin via GitGitGadget
  2019-08-24 22:07 ` [PATCH 1/1] mingw: support UNC in git clone file://server/share/repo Torsten Bögershausen via GitGitGadget
  2019-08-26 17:06 ` [PATCH 0/1] mingw: support UNC as file://server/share/repo Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-08-24 22:07 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Windows users might think that the common file:/// protocol also works for
network shares. This patch makes it so.

Torsten Bögershausen (1):
  mingw: support UNC in git clone file://server/share/repo

 connect.c             |  4 ++++
 t/t5500-fetch-pack.sh | 13 +++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)


base-commit: 5d826e972970a784bd7a7bdf587512510097b8c7
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-93%2Fdscho%2Ffile-url-to-unc-path-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-93/dscho/file-url-to-unc-path-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/93
-- 
gitgitgadget

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

* [PATCH 1/1] mingw: support UNC in git clone file://server/share/repo
  2019-08-24 22:07 [PATCH 0/1] mingw: support UNC as file://server/share/repo Johannes Schindelin via GitGitGadget
@ 2019-08-24 22:07 ` Torsten Bögershausen via GitGitGadget
  2019-08-26 17:06 ` [PATCH 0/1] mingw: support UNC as file://server/share/repo Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Torsten Bögershausen via GitGitGadget @ 2019-08-24 22:07 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Torsten Bögershausen

From: =?UTF-8?q?Torsten=20B=C3=B6gershausen?= <tboegi@web.de>

Extend the parser to accept file://server/share/repo in the way that
Windows users expect it to be parsed who are used to referring to file
shares by UNC paths of the form \\server\share\folder.

[jes: tightened check to avoid handling file://C:/some/path as a UNC
path.]

This closes https://github.com/git-for-windows/git/issues/1264.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 connect.c             |  4 ++++
 t/t5500-fetch-pack.sh | 13 +++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/connect.c b/connect.c
index 24281b6082..d72772a36d 100644
--- a/connect.c
+++ b/connect.c
@@ -918,6 +918,10 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
 
 	if (protocol == PROTO_LOCAL)
 		path = end;
+	else if (protocol == PROTO_FILE && *host != '/' &&
+		 !has_dos_drive_prefix(host) &&
+		 offset_1st_component(host - 2) > 1)
+		path = host - 2; /* include the leading "//" */
 	else if (protocol == PROTO_FILE && has_dos_drive_prefix(end))
 		path = end; /* "file://$(pwd)" may be "file://C:/projects/repo" */
 	else
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 086f2c40f6..f021db44b1 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -698,13 +698,22 @@ do
 	# file with scheme
 	for p in file
 	do
-		test_expect_success "fetch-pack --diag-url $p://$h/$r" '
+		test_expect_success !MINGW "fetch-pack --diag-url $p://$h/$r" '
 			check_prot_path $p://$h/$r $p "/$r"
 		'
+		test_expect_success MINGW "fetch-pack --diag-url $p://$h/$r" '
+			check_prot_path $p://$h/$r $p "//$h/$r"
+		'
+		test_expect_success MINGW "fetch-pack --diag-url $p:///$r" '
+			check_prot_path $p:///$r $p "/$r"
+		'
 		# No "/~" -> "~" conversion for file
-		test_expect_success "fetch-pack --diag-url $p://$h/~$r" '
+		test_expect_success !MINGW "fetch-pack --diag-url $p://$h/~$r" '
 			check_prot_path $p://$h/~$r $p "/~$r"
 		'
+		test_expect_success MINGW "fetch-pack --diag-url $p://$h/~$r" '
+			check_prot_path $p://$h/~$r $p "//$h/~$r"
+		'
 	done
 	# file without scheme
 	for h in nohost nohost:12 [::1] [::1]:23 [ [:aa
-- 
gitgitgadget

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

* Re: [PATCH 0/1] mingw: support UNC as file://server/share/repo
  2019-08-24 22:07 [PATCH 0/1] mingw: support UNC as file://server/share/repo Johannes Schindelin via GitGitGadget
  2019-08-24 22:07 ` [PATCH 1/1] mingw: support UNC in git clone file://server/share/repo Torsten Bögershausen via GitGitGadget
@ 2019-08-26 17:06 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2019-08-26 17:06 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget; +Cc: git

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> Windows users might think that the common file:/// protocol also works for
> network shares. This patch makes it so.

Thanks, both.

>
> Torsten Bögershausen (1):
>   mingw: support UNC in git clone file://server/share/repo
>
>  connect.c             |  4 ++++
>  t/t5500-fetch-pack.sh | 13 +++++++++++--
>  2 files changed, 15 insertions(+), 2 deletions(-)
>
>
> base-commit: 5d826e972970a784bd7a7bdf587512510097b8c7
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-93%2Fdscho%2Ffile-url-to-unc-path-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-93/dscho/file-url-to-unc-path-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/93

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

end of thread, other threads:[~2019-08-26 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-24 22:07 [PATCH 0/1] mingw: support UNC as file://server/share/repo Johannes Schindelin via GitGitGadget
2019-08-24 22:07 ` [PATCH 1/1] mingw: support UNC in git clone file://server/share/repo Torsten Bögershausen via GitGitGadget
2019-08-26 17:06 ` [PATCH 0/1] mingw: support UNC as file://server/share/repo Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).