mingw: support UNC as file://server/share/repo
cover mingw: support UNC as file://server/share/repo
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
Signature · 1 line
gitgitgadget
PATCH 1/1 mingw: support UNC in git clone file://server/share/repo
From: =?UTF-8?q?Torsten=20B=C3=B6gershausen?= <[email protected]>
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.
--- connect.c | 4 ++++ t/t5500-fetch-pack.sh | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-)
connect.c +4 -0
@@ -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
t/t5500-fetch-pack.sh +11 -2
@@ -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
Signature · 1 line
gitgitgadget
"Johannes Schindelin via GitGitGadget" <[email protected]>
Quoted 2 lines · writes:
Windows users might think that the common file:/// protocol also works for network shares. This patch makes it so.
Thanks, both.
Quoted 13 lines
Torsten Bögershausen (1):
mingw: support UNC in git clone file://server/share/repoconnect.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