Skip to content

Cannot parse "scp-style" git URLs #220

@nipunn1313

Description

@nipunn1313

Short code to highlight issue:

extern crate url;

use url::Url;

fn main() {
    println!("1) {}", Url::parse("ssh://user@host.xz/path/to/repo.git/").unwrap());
    println!("2) {}", Url::parse("user@host.xz:path/to/repo.git/").unwrap());
}

The first line parses, but the second fails with
thread 'main' panicked at 'called Result::unwrap() on an Err value: RelativeUrlWithoutBase', ../src/libcore/result.rs:788

straight from git help clone we see that the second is a valid format

       The following syntaxes may be used with them:

       o   ssh://[user@]host.xz[:port]/path/to/repo.git/

       o   git://host.xz[:port]/path/to/repo.git/

       o   http[s]://host.xz[:port]/path/to/repo.git/

       o   ftp[s]://host.xz[:port]/path/to/repo.git/

       o   rsync://host.xz/path/to/repo.git/

       An alternative scp-like syntax may also be used with the ssh protocol:

       o   [user@]host.xz:path/to/repo.git/

See https://secure.phabricator.com/T11004 for an explanation why the "scp-like" syntax is not exactly the same as the ssh syntax. For me, switching to the ssh style syntax is insufficient on its own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions