Skip to content

Commit eeeceda

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 e771eb0 + 07c8f47 commit eeeceda

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
@@ -706,13 +706,22 @@ do
706706
# file with scheme
707707
for p in file
708708
do
709-
test_expect_success "fetch-pack --diag-url $p://$h/$r" '
709+
test_expect_success !MINGW "fetch-pack --diag-url $p://$h/$r" '
710710
check_prot_path $p://$h/$r $p "/$r"
711711
'
712+
test_expect_success MINGW "fetch-pack --diag-url $p://$h/$r" '
713+
check_prot_path $p://$h/$r $p "//$h/$r"
714+
'
715+
test_expect_success MINGW "fetch-pack --diag-url $p:///$r" '
716+
check_prot_path $p:///$r $p "/$r"
717+
'
712718
# No "/~" -> "~" conversion for file
713-
test_expect_success "fetch-pack --diag-url $p://$h/~$r" '
719+
test_expect_success !MINGW "fetch-pack --diag-url $p://$h/~$r" '
714720
check_prot_path $p://$h/~$r $p "/~$r"
715721
'
722+
test_expect_success MINGW "fetch-pack --diag-url $p://$h/~$r" '
723+
check_prot_path $p://$h/~$r $p "//$h/~$r"
724+
'
716725
done
717726
# file without scheme
718727
for h in nohost nohost:12 [::1] [::1]:23 [ [:aa

0 commit comments

Comments
 (0)