Skip to content

Commit

Permalink
Merge branch 'tb/file-url-to-unc-path'
Browse files Browse the repository at this point in the history
Windows update.

* tb/file-url-to-unc-path:
  mingw: support UNC in git clone file://server/share/repo
  • Loading branch information
gitster committed Sep 30, 2019
2 parents b57a88a + ebb8d2c commit aadac06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions connect.c
Expand Up @@ -915,6 +915,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
Expand Down
13 changes: 11 additions & 2 deletions t/t5500-fetch-pack.sh
Expand Up @@ -708,13 +708,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
Expand Down

0 comments on commit aadac06

Please sign in to comment.