Skip to content

Commit 94501a6

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge branch 'file-url-to-unc-path'
This topic branch teaches Git to accept UNC paths of the form file://host/share/repository.git. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents f0b9712 + 4f3f792 commit 94501a6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

connect.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,10 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
915915

916916
if (protocol == PROTO_LOCAL)
917917
path = end;
918+
else if (protocol == PROTO_FILE && *host != '/' &&
919+
!has_dos_drive_prefix(host) &&
920+
offset_1st_component(host - 2) > 1)
921+
path = host - 2; /* include the leading "//" */
918922
else if (protocol == PROTO_FILE && has_dos_drive_prefix(end))
919923
path = end; /* "file://$(pwd)" may be "file://C:/projects/repo" */
920924
else

t/t5500-fetch-pack.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,13 +708,22 @@ do
708708
# file with scheme
709709
for p in file
710710
do
711-
test_expect_success "fetch-pack --diag-url $p://$h/$r" '
711+
test_expect_success !MINGW "fetch-pack --diag-url $p://$h/$r" '
712712
check_prot_path $p://$h/$r $p "/$r"
713713
'
714+
test_expect_success MINGW "fetch-pack --diag-url $p://$h/$r" '
715+
check_prot_path $p://$h/$r $p "//$h/$r"
716+
'
717+
test_expect_success MINGW "fetch-pack --diag-url $p:///$r" '
718+
check_prot_path $p:///$r $p "/$r"
719+
'
714720
# No "/~" -> "~" conversion for file
715-
test_expect_success "fetch-pack --diag-url $p://$h/~$r" '
721+
test_expect_success !MINGW "fetch-pack --diag-url $p://$h/~$r" '
716722
check_prot_path $p://$h/~$r $p "/~$r"
717723
'
724+
test_expect_success MINGW "fetch-pack --diag-url $p://$h/~$r" '
725+
check_prot_path $p://$h/~$r $p "//$h/~$r"
726+
'
718727
done
719728
# file without scheme
720729
for h in nohost nohost:12 [::1] [::1]:23 [ [:aa

0 commit comments

Comments
 (0)