diff options
author | Torsten Bögershausen <tboegi@web.de> | 2013-11-28 20:50:03 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-12-09 14:54:48 -0800 |
commit | c59ab2e52a64abd7fded97e0983a9b7f3d0508a0 (patch) | |
tree | ec8fbc7ea0cc3a49ee0519425c486d03bb1325cc /t | |
parent | 83b058752707a6ba4af51ebc98c47913bc7d2d25 (diff) | |
download | git-c59ab2e52a64abd7fded97e0983a9b7f3d0508a0.tar.gz git-c59ab2e52a64abd7fded97e0983a9b7f3d0508a0.tar.xz |
connect.c: refactor url parsing
Make the function is_local() in transport.c public, rename it into
url_is_local_not_ssh() and use it in both transport.c and connect.c
Use a protocol "local" for URLs for the local file system.
One note about using file:// under Windows:
The (absolute) path on Unix like system typically starts with "/".
When the host is empty, it can be omitted, so that a shell scriptlet
url=file://$pwd
will give a URL like "file:///home/user/repo".
Windows does not have the same concept of a root directory located in "/".
When parsing the URL allow "file://C:/user/repo"
(even if RFC1738 indicates that "file:///C:/user/repo" should be used).
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t5500-fetch-pack.sh | 7 | ||||
-rwxr-xr-x | t/t5601-clone.sh | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index b4866ea3a..5b2b1c2c1 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -612,4 +612,11 @@ do done done +test_expect_success MINGW 'fetch-pack --diag-url file://c:/repo' ' + check_prot_path file://c:/repo file c:/repo +' +test_expect_success MINGW 'fetch-pack --diag-url c:repo' ' + check_prot_path c:repo file c:repo +' + test_done diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 53a1de9ef..62fbd7e66 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -362,6 +362,14 @@ do test_clone_url [::1]:$repo ::1 $repo ' done +#home directory +test_expect_success "clone host:/~repo" ' + test_clone_url host:/~repo host "~repo" +' + +test_expect_success "clone [::1]:/~repo" ' + test_clone_url [::1]:/~repo ::1 "~repo" +' # Corner cases for url in foo/bar:baz [foo]bar/baz:qux [foo/bar]:baz |