Skip to content

Commit bc9c2f9

Browse files
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 91df2dc + d1ccbf3 commit bc9c2f9

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
@@ -918,6 +918,10 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
918918

919919
if (protocol == PROTO_LOCAL)
920920
path = end;
921+
else if (protocol == PROTO_FILE && *host != '/' &&
922+
!has_dos_drive_prefix(host) &&
923+
offset_1st_component(host - 2) > 1)
924+
path = host - 2; /* include the leading "//" */
921925
else if (protocol == PROTO_FILE && has_dos_drive_prefix(end))
922926
path = end; /* "file://$(pwd)" may be "file://C:/projects/repo" */
923927
else

t/t5500-fetch-pack.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,22 @@ do
695695
# file with scheme
696696
for p in file
697697
do
698-
test_expect_success "fetch-pack --diag-url $p://$h/$r" '
698+
test_expect_success !MINGW "fetch-pack --diag-url $p://$h/$r" '
699699
check_prot_path $p://$h/$r $p "/$r"
700700
'
701+
test_expect_success MINGW "fetch-pack --diag-url $p://$h/$r" '
702+
check_prot_path $p://$h/$r $p "//$h/$r"
703+
'
704+
test_expect_success MINGW "fetch-pack --diag-url $p:///$r" '
705+
check_prot_path $p:///$r $p "/$r"
706+
'
701707
# No "/~" -> "~" conversion for file
702-
test_expect_success "fetch-pack --diag-url $p://$h/~$r" '
708+
test_expect_success !MINGW "fetch-pack --diag-url $p://$h/~$r" '
703709
check_prot_path $p://$h/~$r $p "/~$r"
704710
'
711+
test_expect_success MINGW "fetch-pack --diag-url $p://$h/~$r" '
712+
check_prot_path $p://$h/~$r $p "//$h/~$r"
713+
'
705714
done
706715
# file without scheme
707716
for h in nohost nohost:12 [::1] [::1]:23 [ [:aa

0 commit comments

Comments
 (0)